Post Meta on Homepage

Community Forums Forums General Discussion Post Meta on Homepage

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  cehwitham 1 year, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #18725

    angieatc
    Participant
    Post count: 80

    I think I am making this a lot harder than what it needs to be but I am curious if I can use a shortcode for something to show up just on the homepage but then use the shortcode in the post-meta as well. Here is the site: http://test4.strosgirldesigns.com/

    I do not want the post-meta (categories & tags) to appear on the homepage HOWEVER I do want it to show up on the post area but I would like to have the social sharing buttons to show up on the homepage ONLY. Is this possible?

    I am using the Pretty Young Theme

    Here is what I have in my functions file for the post meta

    /** Customize the post meta function */
    add_filter( ‘genesis_post_meta’, ‘post_meta_filter’ );
    function post_meta_filter($post_meta) {
    if ( !is_page() ) {
    $post_meta = ‘[post_categories before="Filed Under: "] [post_tags before="Tagged: "]<br/><center>[social_share/]</center>’;
    return $post_meta;
    }}

    on the homepage I would just like this

    /** Customize the post meta function */
    add_filter( ‘genesis_post_meta’, ‘post_meta_filter’ );
    function post_meta_filter($post_meta) {
    if ( !is_page() ) {
    $post_meta = ‘<center>[social_share/]</center>’;
    return $post_meta;
    }}

     

    • This topic was modified 1 year, 6 months ago by  angieatc.
    • This topic was modified 1 year, 6 months ago by  angieatc.
    #21240

    cehwitham
    Participant
    Post count: 396

    You’re 90% there, you’ve got all the code you need. All you need to do is combine the two pieces of code, put the homepage code first in the function and do if is_front_page then an else condition for the pages.

    Then when the filter runs, if it’s on the homepage it will filter it for the homepage and otherwise set it up for internal pages.

    http://codex.wordpress.org/Conditional_Tags

    Alternatively, you could create a template file for the front page, put the front page filter code in there and then create a page.php template file and put the filtering code for the pages in there. This would save you having to write the IF statements.


    Twitter: cehwitham Web: cehwitham.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.