• I would like to replace the entry-title with custom meta information located in the post layout of post lists (Recent Posts).

    ie., Instead of the entry title being “Hello World”, it would display the output of item_price. (item_price being a custom field defined in the post.)

    I assume this can be done with a hook. I’m just now learning how hooks work. any help would be awesome.

    Bonus
    I’d also like to make the entry-title linkable to another custom field. ie., Instead of linking to nothing, it would like to the output of item_link. (item_link being another, separate custom meta field defined in the post.)

Viewing 1 replies (of 1 total)
  • Thread Starter Devin J Dawson

    (@devinjdawson)

    Some code I am messing with for making entry-titles linkable:

    function tc_grid_set_expanded_post_title( $_html ){
              if ( ! $this -> tc_force_current_post_expansion() )
                  return $_html;
              global $post;
              $_title = apply_filters( 'tc_grid_expanded_title' , $post->post_title );
              $_title = apply_filters( 'tc_the_title'           , $_title );
              $_title = apply_filters( 'tc_grid_expanded_title_html',
    $linkvalue = get_post_meta($post->ID, 'affiliate_link', true);
    if($linkvalue) {
              sprintf('<h2 class="entry-title"><a href="' . $linkvalue . '" rel="bookmark">%1$s</a></h2>',
                  $_title
              ) );
              }
    else {
              sprintf('<h2 class="entry-title">%1$s</h2>',
                  $_title
              ) );
            }
              return $_html . $_title;
            }


    Note
    affiliate_link would take the place of item_link mentioned in the original post.

Viewing 1 replies (of 1 total)
  • The topic ‘Display meta information on the post layout in post lists’ is closed to new replies.