New answers tagged

0

Here is the anatomy of a shortcode, and how to add and then use them. add_shortcode('my_custom_shortcode', function ($atts, $content = NULL, $tag = NULL) { $defaults = ['a' => 'default A', 'b' => 'default B', 'c' => 'default C']; $atts = shortcode_atts($defaults, $atts, $tag); ob_start(); ?> <h2>This is shortcode &...


1

If you don't need to worry about WordPress filters on getting post meta, you probably can just do this with a single SQL statement and iterate through the results, rather than relying on WordPress to get the values from the database, since that's 20,000 sql statements, plus the memory of caching all that data (which WordPress does behind the scenes when you ...


4

Here is an improvement, but I would recommend a few additional changes as well. <?php global $post; ?> <div class="col kb_landing_left"> <?php $post = get_post(56); setup_postdata($post); get_template_part('template-parts/content', 'page'); ?> </div> <div class="col -sm-6"> <?php ...


Top 50 recent answers are included