Tagged: , , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #28053

    Hi, I’d like to change two things: change the meta under the images on the grid layout (comments/dates) & the informations on the articles themselves.

    I – GRID LAYOUT

    Currently on the grid preview layout it goes like this:

    2 Comments / August 4, 2013

    I’d like to do something like:

    2 Comments | August 4, 2013 | Author (with link)

    Is it possible to change the text when there are zero comments?

    like “Contribute” instead of “0 Comments”.

    I’m also interested in knowing if the date can be numerical or shorter, like 2013.07.23 or Aug 4, 2013.

    II – BLOG POSTS

    In the same vain, I’d like to achieve differents results on the full articles meta.

    Currently it gives:

    05 Aug 2013 / 0 Comments / in News / by Author

    I’d like to know if the date can be longer like it is on the original grid meta, and if an alternative text can be shown when there are 0 comments.

    Something like:

    Full Date (August 5, 2013) | Contribute | in News | by Author

    III – BONUS QUESTION

    Hope this is not too much at once, but I’m also wondering if the grid can be manipulated to show the text/meta/excerpt in a white shadowed box, like it is the case with the portfolio example pages.

    Cheers!

    #136282

    Hi,

    1) Open up wp-contentthemesenfoldconfig-templatebuilderavia-shortcodespostslider.php and replace

    if($show_meta && !empty($excerpt))
    {
    $output .= "<div class='slide-meta'>";
    if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
    {
    $link_add = $commentCount === "0" ? "#respond" : "#comments";
    $text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );

    $output .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a></div><div class='slide-meta-del'>/</div>";
    }
    $output .= "<div class='slide-meta-time'>" .get_the_time(get_option('date_format'), $the_id)."</div>";
    $output .= "</div>";
    }

    with

    if($show_meta && !empty($excerpt))
    {
    $output .= "<div class='slide-meta'>";
    if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
    {
    $link_add = $commentCount === "0" ? "#respond" : "#comments";
    if($commentCount == "0")
    {
    $text_add = __('Contribute', 'avia_framework' );
    }
    else
    {
    $text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );
    }

    $output .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a></div><div class='slide-meta-del'> | </div>";
    }
    $output .= "<div class='slide-meta-time'>" .get_the_time(get_option('date_format'), $the_id)."</div>";
    $author_id = $entry->post_author;
    $author_url = get_the_author_meta( 'url' , $author_id );
    $author_name = get_the_author_meta( 'display_name' , $author_id );

    $output .= 'by <a href="'.$author_url.'">'.$author_name.'</a>';
    $output .= "</div>";
    }

    If you want to change the date replace get_option(‘date_format’) with a custom date format – see: http://codex.wordpress.org/Formatting_Date_and_Time

    2) In includes/loop-index.php replace

    comments_popup_link(  "0 ".__('Comments','avia_framework'),
    "1 ".__('Comment' ,'avia_framework'),
    "% ".__('Comments','avia_framework'),'comments-link',
    "".__('Comments Disabled','avia_framework'));

    with

    comments_popup_link(  __('Contribute','avia_framework'),
    "1 ".__('Comment' ,'avia_framework'),
    "% ".__('Comments','avia_framework'),'comments-link',
    "".__('Comments Disabled','avia_framework'));

    3) No, the portfolio grid uses a different css & html code and this would require some customization.

    #136283

    Hi Dude,

    Thanks for solving/answering my questions and taking the time to code.

    The loop index code works great, it shows the “Contribute” text instead of “0 comments” and I change the date format.

    a) The postslider code shows the Author, but it links to the author’s website.

    Is there a way to link to the author’s archive like it’s the case in the blog post meta, where it links to http://website.com/author/username/?

    b) Still related to the postslider code, the “0 comment” replacement in the grid doesn’t work as flawlessly as in the loop index code.

    It shows “0 Contribute” instead of just “Contribute”. Can the “0” be totally removed?

    Thanks again. Hope this is not too much questions!

    #136284

    Hey,

    1.) Please use this instead:

    if($show_meta && !empty($excerpt))
    {
    $output .= "<div class='slide-meta'>";
    if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio')
    {
    $link_add = $commentCount === "0" ? "#respond" : "#comments";
    if($commentCount == "0")
    {
    $text_add = __('Contribute', 'avia_framework' );
    }
    else
    {
    $text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' );
    }

    $output .= "<div class='slide-meta-comments'><a href='{$link}{$link_add}'>{$commentCount} {$text_add}</a></div><div class='slide-meta-del'> | </div>";
    }
    $output .= "<div class='slide-meta-time'>" .get_the_time(get_option('date_format'), $the_id)."</div>";
    $author_id = $entry->post_author;
    $author_url = get_site_url()."/author/".get_the_author_link();
    $author_name = get_the_author_meta( 'display_name' , $author_id );

    $output .= 'by <a href="'.$author_url.'">'.$author_name.'</a>';
    $output .= "</div>";
    }

    2.) Edit this line of code on loop-index.php:

    comments_popup_link( "0 ".__('Comments','avia_framework'),

    Replace it with:

    comments_popup_link( "".__('Comments','avia_framework'),

    Regards,

    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Change meta on grid & blog posts’ is closed to new replies.