Support » Plugin: Carousel Slider » Post dates are wrong

  • page52

    (@page52)


    Hi Sayful,

    I love this plugin and I’ve managed to set it up the way I want to use it for the most part, but I just noticed the blog post dates on the slider are wrong.

    I’m using the slider on http://www.foodandthefabulous.com/ and am using post carousel showing 9 latest posts in descending order (the order also seems wrong).

    Please help?

    Thanks,
    Nat

Viewing 7 replies - 1 through 7 (of 7 total)
  • questus

    (@questus)

    G’day Nat,
    Sorry to barge in, but I was curious, and had a look.

    I picked a post at random on the carousel, “Lunch with Slow Food’s Carlo Petrini”, which showed a date in the carousel of ‘September 6, 2016’.
    The post displayed when clicked on that carousel entry showed the date ‘August 24th, 2016’, which is obviously different.

    But when I looked at the source code for the page at the date point with the inspector I found the following;

    <span class="updated rich-snippet-hidden">2016-09-06T20:43:09+00:00</span>
    <span>August 24th, 2016</span>

    There are two dates displayed, the hidden one is the same date that is shown on the carousel, but in a UTC format, and the second date, being visible, show the date which is different from the one shown in the carousel.

    I would check the date for the specific post in the Dashboard, it would not surprise me if the September date was the post date.
    If that is the case, there may be something awry with the post display template in the theme.
    There is another date associated with posts called ‘modified date’ which is used when a post is ‘scheduled’, maybe something like that is being displayed with the post.

    That’s my lot I’m afraid. I’ve only just started with WordPress, so my knowledge is a bit “light”.

    /David…

    page52

    (@page52)

    Hi David,

    Thank you – you hit the nail on the head. The page source shows:

    <meta property="article:published_time" content="2016-08-24T17:43:31+02:00" />
    <meta property="article:modified_time" content="2016-09-06T20:43:09+02:00" />

    I wonder if there’s any way to make sure it only shows the published date and not the modified date?

    questus

    (@questus)

    Well, that may well be a trickier one.
    A bit out of my current scope of knowledge, but if I think of something, I’ll post it.

    Plugin Author Sayful Islam

    (@sayful)

    Hello,

    Inside the plugin code it check if post modified and post date are same. If both date are same it show post date. If both date are not same it show modified date. This rule is pretty common for many theme at WordPress.org and others source.

    Maybe your theme is displaying post date.

    If you set order by as Last modified date, the carousel will be displayed as modified date not post date.

    If you want to show post date (Not modified date) on carousel slider, Only one option is available by modifying filter hook. The following hook available to modify existing template for post carousel.

    return apply_filters( 'carousel_slider_posts_carousel', $html, $id, $posts );

    Here $html are current html code. $id is current carousel slider id that you can use to get all settings and $posts are all posts related to this carousel slider.

    I have a plan to give option to modify all settings for post carousel. But I can not get enough time for this.

    Thanks

    page52

    (@page52)

    Thanks Sayful, I appreciate you taking the time on this.

    Can you please confirm – the above code is to go into functions.php? Where will I find the html code to insert?

    Thank you!

    Plugin Author Sayful Islam

    (@sayful)

    Hello,
    You can add the following code at your theme functions.php file.

    
    add_filter( 'carousel_slider_posts_carousel', 'my_theme_name_carousel_slider_posts_carousel', 10, 3 );
    
    function my_theme_name_carousel_slider_posts_carousel( $html, $id, $posts )
    {
    	# modify $html in some way.
    	return $html;
    }

    If you need to write the function from me, send me private mail at sayful.islam001@gmail.com

    questus

    (@questus)

    This is a fascinating solution, and I can imagine a variety of slider customisations that might be possible.

    The “add_filter” directive replaces the declaration in class-carousel-slider-shortcode.php ? Although the specific function of the “10” and “3” parameter I am not sure of. Used for $id and &posts maybe?

    And in place of ‘# modify $html in some way’, the use of the output buffer function with an alternate to the post-carousel.php could be used similarly?

    … of course, if I was more familiar with php, some of these points might be more obvious.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Post dates are wrong’ is closed to new replies.