Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #509433

    Hello,

    I want to show number of posts in the footer of my site (using enfold).
    The number of posts needs to be wrapped by <!-- 全記事数 --> (i.e. the post number needs to have a <!-- 全記事数 --> before it and after it. its a condition for registering to a certain antenna site)

    I have asked this question before here: https://kriesi.at/support/topic/show-number-of-posts-wrapped-by/
    and got help, but the code had a small mistake in it, the <!-- 全記事数 --> had one too many dashes.

    Would you be able to help again?

    The correct code is:

    <?php $numposts = $wpdb->get_var("SELECT count(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ('post', 'news', 'photo')");
    if (0 < $numposts)$numposts = number_format($numposts);echo '<p>動画数:<!-- 全記事数 -->'. $numposts .'<!-- 全記事数 -->動画</p>';?>
    #509868

    Hi jmalevic!

    Thank you for using Enfold.

    I’m not sure what you meant by “the <!– 全記事数 –> had one too many dashes”? The <!– –> is the html comment tag:
    http://www.w3schools.com/tags/tag_comment.asp

    Best regards,
    Ismael

    #510155

    Thank you for the reply and sorry for the confusion.
    The correct code is below.

    <?php $numposts = $wpdb->get_var("SELECT count(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ('post', 'news', 'photo')");
    if (0 < $numposts)$numposts = number_format($numposts);echo '<p>動画数:<code><!-- 全記事数 --></code>'. $numposts .'<!-- 全記事数 -->動画</p>';?>

    I have this code in the footer of my site right now and it shows number of posts correctly, but for some reason does not show the <!-- 全記事数 --> before and after the postnumber on enfold (it does show it if I shitch to the default wp theme).

    Is there anyway to make this show on enfold?

    #510762

    Hi!

    Thank you for the info. Try to replace the code with this:

    <?php $numposts = $wpdb->get_var("SELECT count(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ('post', 'news', 'photo')");
    if (0 < $numposts)$numposts = number_format($numposts); $text = "動画数:<!-- 全記事数 --> {$numposts} <!-- 全記事数 -->動画"; echo $text;?>
    

    Best regards,
    Ismael

    #510802

    Thank you for the reply.
    The code you provided still does not seem to be working..
    For your reference I’m attaching a comparison pic of the code on the site where its showing correctly.

    #511956

    Hey!

    This is what I get when I add the code:

    Please remove browser cache then check the page again.

    Best regards,
    Ismael

    #512195

    Sorry, its not working for me. Would you be able to try adding it?

    #512510

    Hey!

    Is the site subscribed to a cdn? Please try to purge the cache. Check the site on another browser.

    Regards,
    Ismael

    #513173

    Hello,

    Sorry, I cleared the cache and checked on a different browser but I’m pretty sure its not working..

    #514257

    Hey!

    Not sure why it’s not working on your end. Please try to contact a developer here: http://kriesi.at/contact/customization

    Best regards,
    Ismael

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