Gallery plugin forces itself above text

Your shortcode function callback must return the output, like this: function gamma_gallery( $attr ) { $html=””; // your stuff, where all the output is assigned to the $html variable return $html; } or you could try the output buffering: function gamma_gallery( $attr ) { $html=””; ob_start(); // your stuff $html = ob_get_contents(); ob_end_clean(); return $html; … Read more

JQuery not working in my plugin [closed]

You’re using an invalid action: add_action(‘wp_enqueue_script’, ‘run_js_script’); The correct action is wp_enqueue_scripts (plural), not wp_enqueue_script (singular). Use this instead: add_action(‘wp_enqueue_scripts’, ‘run_js_script’); Edit Same problem here: add_action(‘wp_register_script’, ‘register_script’); Just hook it into wp_enqueue_scripts for simplicity: add_action(‘wp_enqueue_scripts’, ‘register_script’); Actually, two better options: Put your wp_register_script() call in the same run_js_script callback as your wp_enqueue_script() call. Eliminate wp_register_script() … Read more

Woocommerce Attributes pulling in wrong data

You are confusing get_terms() with get_the_terms() get_terms() returns an array all the terms in a taxonomy. get_the_terms() returns an array of all the terms for a particular post. global $post; $terms = get_the_terms( $post->ID, ‘pa_size’); foreach ( $terms as $term ) { echo “<li>” .$term->name. “</li>”; } You might also like get_the_term_list() which would be … Read more

Adding custom code to a WordPress site

If your custom code should output something where normally you have post content, use a shortcode. Convert your code in a plugin, this can be done simply adding plugins header, even only <?php /** * Plugin Name: My Plugin */ on top of your php file. More info here. After that use the add_shortcode function … Read more

Get post by ASC from custome field DATE picker

So what you need to do is order it by the custom value of the meta_key date value. Something like this (untested): $wp_query = new WP_Query( array( ‘post_type’ => ‘upcoming_events’, ‘order’ => ‘ASC’, ‘meta_query’ => array ( array ( ‘key’ => ‘your_custom_date_key’, ‘value’ => date(‘Y-m-d’) ) ), ‘orderby’ => ‘meta_value’ ) ); Hope that helps.