show data, hook problems

Bring Your Business to LifeSupportPopular Widgetshow data, hook problems

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #256076
    rhadmin
    Participant

    Hi

    Could you please explain for those less experienced with programming how to use the hook to display the data of each post in the popular widget?

    Best
    RH

    #256080
    rhadmin
    Participant

    I mean the DATE of course. sorry

    #256965
    Xpark Media
    Keymaster

    @rhadmin,

    It depends if you want to affect all tabs or just one. Here is the code to affect all tabs. Remove lines of code as needed. You will need to add the code in a plugin or the functions.php file in your theme.

    if you want to display the date after the title use:

    
    function add_date_after_title(  $title, $post  ){
    return $title .= get_the_time( '', $post->ID );
    }
    add_filter('pop_recent_title', 'add_date_after_title',10, 2);
    add_filter('pop_commented_title', 'add_date_after_title',10, 2);
    add_filter('pop_viewed_title', 'add_date_after_title',10, 2);
    
    #282421
    lilymill
    Participant

    Hi!
    I need to show data too, where do I have to add the code above in the plugin functions.php file?

    Thank you!
    L

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.