How to create shortcode of this PHP code

This should do it.. function future_posts_function($atts){ extract(shortcode_atts(array( ‘poststatus’ => ‘future’, ‘order’ => ‘DESC’, ‘showposts’ => 10, ), $atts)); $return_string = ‘<ul>’; query_posts(array(‘post_status’ => $poststatus, ‘order’ => $order, ‘showposts’ => $showposts)); if (have_posts()) : while (have_posts()) : the_post(); $return_string .= ‘<li>’.get_the_title().'</li>’; endwhile; endif; $return_string .= ‘</ul>’; wp_reset_query(); return $return_string; } add_shortcode(‘future_posts’, ‘future_posts_function’);

How can I fix my pagination?

You need to add the paged parameter to your WPQuery: $paged = ( get_query_var(‘paged’) ) ? get_query_var(‘paged’) : 1; $query = new WP_Query( array( ‘posts_per_page’ => 5, ‘paged’ => $paged ) ); Here are the docs.

$_html is empty when var dumped

so I turn to you guys to help me see what I am doing wrong here. First thing your doing wrong is over complicating a simple effective API. Your code makes no sense. Your mixing functions that echo output with arbitrary html mark up that gets assigned to a non existing class property that nothing … Read more

Retrieve Array from within Array [closed]

It looks like you are using Advanced Custom Fields. Your “Product ID” is storing the object, instead of just the ID. Below shows you how you can access the post ID, otherwise just change your field saving option for Product ID. It’s a simple foreach statement. foreach( $pages as $page ) { echo $page[‘product_id’]->ID; }

Really slow WordPress site [closed]

After reviewing a WebPageTest of your site, it looks like you’re loading a lot of different JavaScript and CSS files. I would really recommend to minify and combine your JavaScript and CSS. You can use CloudFlare (which I highly recommend), W3 Total Cache, or WP Minify Fix. Be careful though, often times minification can break … Read more