
-
AuthorPosts
-
September 26, 2015 at 10:17 am #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>';?>
September 28, 2015 at 9:02 am #509868Hi 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.aspBest regards,
IsmaelSeptember 28, 2015 at 3:21 pm #510155Thank 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?
September 29, 2015 at 2:30 pm #510762Hi!
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,
IsmaelSeptember 29, 2015 at 3:48 pm #510802Thank 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.October 1, 2015 at 6:44 am #511956Hey!
This is what I get when I add the code:
Please remove browser cache then check the page again.
Best regards,
IsmaelOctober 1, 2015 at 2:57 pm #512195Sorry, its not working for me. Would you be able to try adding it?
October 2, 2015 at 4:46 am #512510Hey!
Is the site subscribed to a cdn? Please try to purge the cache. Check the site on another browser.
Regards,
IsmaelOctober 3, 2015 at 6:03 pm #513173Hello,
Sorry, I cleared the cache and checked on a different browser but I’m pretty sure its not working..
October 6, 2015 at 10:25 am #514257Hey!
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 -
AuthorPosts
- You must be logged in to reply to this topic.