Nested loop called with shortcode duplicating the content above the main loop

You have few errors in your code. Below you can see how it should look like: function cd_random_testimonial($atts) { // EXAMPLE USAGE: // [loop the_query=”showposts=1&post_type=testimonials&orderby=rand”] // Defaults extract(shortcode_atts(array( ‘the_query’ => ” ), $atts)); // de-funkify query $the_query = preg_replace(‘~&#x0*([0-9a-f]+);~ei’, ‘chr(hexdec(“\\1”))’, $the_query); $the_query = preg_replace(‘~&#0*([0-9]+);~e’, ‘chr(\\1)’, $the_query); // query is made $my_query = new WP_Query( $the_query … Read more

load plugin with ajax [duplicate]

looking at the html output of the plugin code, i can say u that the plugin loads everything else (textarea and history) with javascript (see all those data- attributes and loading message). Now if the call to function was made on page load(non-ajaxy way), the plugin would have loaded requried javascript files and then things … Read more

Need to change contact email depending where user is from

Your themes functions.php is the first file that gets loaded after wordpress, it loads on every page load so you can get a variable with it. You could create a function similar to so and put it in your functions.php of your theme: global $fromwhere; if(isset($_GET[‘from’]) and $_GET[‘from’] == ‘columbiansite’){ global $fromwhere; $fromwhere=”columbia”; } you … Read more

How to show custom taxonomy child posts through shortcode in WordPress

That is a very messy shortcode but it looks like if you pass a term slug into the shortcode cat att this part… if (of_get_option(‘shortcat_video’, ‘1’) == ‘1’) { $query = array( ‘posts_per_page’ => $items, ‘orderby’ => $orderby, ‘order’ => $order, ‘post_type’ => ‘video’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘videos’, ‘field’ => ‘slug’, ‘terms’ … Read more

Shortcode or placeholder for theme options page?

I am using shortcodes. But you need to work differently with this and make it easier for the client. On the theme options page you should have inputs with type=”checkbox” where the client chooses what share buttons to appear. In the template you should get the option with get_option(‘registered_option’) and display those buttons for which … Read more

Where to place PHP for shortcodes

Shortcodes are processed on display so the code must be available on the front end when the shortcode is processed. Superficially, that means frontend.php. I have never tried to split shortcode code in this way. You may have trouble splitting it off from the backend. The add_shortcode function is in wp-includes/shortcodes.php which loads for both … Read more