the_post() is printing titles in page footer

Instead of query_posts(), use WP_Query(): function shortcode_eventi() { $loop = new WP_Query(array( ‘post_type’ => ‘eventi’ )); ?> <?php if ($loop->have_posts()) : ?> <?php while ($loop->have_posts()) : $loop->the_post(); ?> <small><?php the_time(‘F jS, Y’) ?></small> <?php endwhile; ?> <?php else : ?> <h2 class=”center”>Not Found</h2> <p class=”center”><?php _e(“Sorry, but you are looking for something that isn’t here.”); … Read more

wp_nonce_field is breaking form for reasons unknown

wp_nonce_field() will echo its output by default, so set the $echo parameter to false: add_shortcode(‘signup_form’, ‘get_signup_form’); function get_signup_form() { $wp_nonce_code = wp_nonce_field( -1, ‘_wpnonce’, true, false ); $signup_form_code = <<<EOT <form method=”post” class=”popup-register” action=”/my-account/”> <p style=”text-align:center;”> <input type=”email” class=”popup-input” style=”width: 65%;” name=”email” id=”reg_email” placeholder=”Enter your email address”> <input type=”submit” class=”popup-input-submit button” style=”margin: 0; border: 1px … Read more

How can I include shortcodes within PHP?

In your case do_shortcode should do the trick. If your shortcode is just like [my_shortcode] then try echo do_shortcode( ‘[my_shortcode]’ ); If you have opening and closing then echo do_shortcode( ‘[my_shortcode]Inner text[/my_shortcode]’ );

Exclude category from shortcode

I don’t know of a direct method to achieve this, you should be able to get the category count using get_term then subtract that from the total. function product_count_shortcode( $atts ) { $data = shortcode_atts( array( ‘cat_id’ => 144, ‘taxonomy’ => ‘category’ ), $atts ); $category = get_term( $data[‘cat_id’], $data[‘taxonomy’] ); $count = $category->count; $count_posts … Read more

PHP Running On CMS Side of WordPress

Even with the missing open php tag, this won’t work the way you’re trying to do it. The Divi code module accepts html code and PHP shortcodes. I haven’t tried javascript, so not sure about that. You’ll need to integrate your code as a stand alone plugin. After that, you can use the shortcode in … Read more