Tagged: x
-
AuthorPosts
-
December 16, 2016 at 7:15 pm #1296276
PalzmeParticipantHey
I have created a custom shortcode, by using my functions.php file, but i would like the shortcode really to have the following code to count the published posts:
<?php echo wp_count_posts()->publish; ?>
Is there any way to implement this easily as the code for the shortcode only specifies an output which is HTML based?
function custom_shortcode() {
$output = ‘HTML BASED OUTPUT’;
return $output;
}December 16, 2016 at 7:24 pm #1296288
PalzmeParticipantHey guys,
Just an update- I have managed to work around this now
I installed the following plugin: https://wordpress.org/plugins/php-code-for-posts/ (created a shortcode with the PHP script embedded and that worked perfectly)
If there’s any work arounds to integrate this into a child theme that would be awesome, but for now at least i could use the work around 😉
Kind Regards,
JordanDecember 16, 2016 at 10:22 pm #1296356
RadModeratorHi there,
Thanks for writing in.
You can add something like this from your functions.php
function short_code_name() { $output = 'HTML BASED OUTPUT'; return $output; } add_shortcode('short_code_name', short_code_name);Then simply add
[short_code_name]to your editor content. You can add many as you want, just as long as the shortcode names are unique.Thanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1296276 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
