Ethos - Index Featured Post Layout - metadata

Hi I am using a child theme with ethos.

I have managed to adapt how the ‘recent posts’ show up on my blog index page. I have removed the meta data and created a custom field to create a ‘sub-title.’

How every these changes do not effect how the recent post is shown when using the ‘Index Featured Post Layout’ is selected.

Could you tell me how to replace the meta data in this case with my subtitle and the ‘your custom text’ on the button with ‘view event details’

Hello @BASK,

Thanks for asking. :slight_smile:

You can add following CSS and let us know how it goes:

.featured-meta {display: none;}

.featured-view {display: none;}

Once you add the CSS the output would look something like this:

Thanks.

Hi,

Thanks for that.

.featured-meta {display:none;}

that worked fine to hide the meta data but the second line of css is not what I’m looking for. I would like to change what the button says not just hide it.

And I would also like to display the ‘subtitle’ which is a custom field that I have added. You can see it displays on all other recent posts, that aren’t using ‘index featured post layout’.

Hello There,

Thanks for updating in! The css could only hide or style a button. It will be impossible for css to change the content of the button. You will need custom php code that will display the excerpt contents just like the other post items that is not a featured post. To do that, please do the following:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file

<?php

// =============================================================================
// VIEWS/ETHOS/_INDEX-FEATURED.PHP
// -----------------------------------------------------------------------------
// Featured content output for the index pages.
// =============================================================================

$index_layout           = get_post_meta( get_the_ID(), '_x_ethos_index_featured_post_layout',  true );
$class                  = ( $index_layout == 'on' ) ? 'featured' : '';
$background_image_style = x_ethos_entry_cover_background_image_style();
$categories             = x_ethos_post_categories();

?>

<a href="<?php the_permalink(); ?>" class="entry-thumb <?php echo $class; ?>" style="<?php echo $background_image_style; ?>">
  <?php if ( $index_layout == 'on' && ! is_single() ) : ?>  
    <span class="featured-meta"><?php echo $categories; ?> / <?php echo get_the_date( 'F j, Y' ); ?></span>
    <h2 class="h-featured"><span><?php the_title(); ?></span></h2>
    <span class="featured-view"><?php the_excerpt(); ?></span>
  <?php else : ?>
    <span class="view"><?php _e( 'View Post', '__x__' ); ?></span>
  <?php endif; ?>
</a>

Please do not forget to add any of your modifications in the above code if you have any.

3] Save the file named as _index-featured.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/x-child/framework/views/ethos/

We would loved to know if this has work for you. Thank you.

Hi, Yes I already had the _index-featured.php file set up in my child theme.

What I need to know is what changes to make to this file to achieve my edits.

I want to change the text on the button.

And I want to call my subtitle, which is a custom feild that I already have set up.

Thanks

Hello There,

Well, in that case, you may need to update the line:

<span class="featured-view"><?php the_excerpt(); ?></span>

and have something like this:

<span class="featured-view"><?php echo get_post_meta( get_the_ID(), 'subtitle', true );  ?></span>

I am not sure if subtitle is the correct name of your custom field. Feel free to change to the correct one.

Please let us know how it goes.

Hi That didn’t work.

I have changed the file as follows but there are no apparent changes?

<?php // ============================================================================= // VIEWS/ETHOS/_INDEX-FEATURED.PHP // ----------------------------------------------------------------------------- // Featured content output for the index pages. // ============================================================================= $index_layout = get_post_meta( get_the_ID(), '_x_ethos_index_featured_post_layout', true ); $class = ( $index_layout == 'on' ) ? 'featured' : ''; $background_image_style = x_ethos_entry_cover_background_image_style(); $categories = x_ethos_post_categories(); ?> <?php if ( $index_layout == 'on' && ! is_single() ) : ?>

<?php the_title(); ?>

<?php $subtitles = get_post_custom_values('subtitle'); if ($subtitles != NULL) { foreach($subtitles as $key => $value){ echo $value; } } ?>

<?php _e( 'View Event Details', '__x__' ); ?> <?php else : ?> <?php _e( 'View Event Details', '__x__' ); ?> <?php endif; ?>

Hello There,

To save us some time and resolve your issue, please provide us access to your site so that we can take a closer look at your code. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password

  • FTP Hostname
  • FTP Username
  • FTP Password

Thank you.