wp_customize_image_control default value

I had the same problem a few minutes ago. Here is what I used in the src tag: <?php if (get_theme_mod( ‘custom_logo_image’ )) : echo get_theme_mod( ‘custom_logo_image’); else: echo get_template_directory_uri().’/inc/images/default_logo.png’; endif; ?> It seemed to solve my problem. Let me know if it works for you.

What is the best practice for customizing a plugin’s JavaScript/jQuery?

If a Plugin is coded properly, it will: Use core-bundled jQuery, and any other core-bundled script, rather than bundling/using custom versions of such scripts enqueue its scripts, via wp_enqueue_script(), hooked into an appropriate hook, via an explicit function So, for such a Plugin: You won’t need to worry about customizing/overriding core-bundled scripts, since the Theme … Read more

Filter results with custom field values and dropdown

Edited according to first comments and Pastebin code: <?php /* You can also leave ‘action’ blank: action=”” */ ?> <form method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”> <select name=”my_size” id=”size” class=”postform” onchange=”submit();”> <option selected=”selected”>Choose a size</option> <option value=”10″>10</option> <option value=”20″>20</option> </select> </form> <?php /* Reset filter */ ?> <p><a href=”https://wordpress.stackexchange.com/questions/83928/<?php the_permalink(); ?>”>Clear filter</a></p> <?php if( !isset($_POST[‘my_size’]) || … Read more

Best practice – Meta Query vs. post_clauses for “left join” ordering

You can use pre_get_posts with a callback: <?php defined( ‘ABSPATH’ ) OR exit; /** Plugin Name: (#102854) Order Posts by Foo */ add_filter( ‘pre_get_posts’, ‘wpse_102854_orderby_foo’ ); function wpse_102854_orderby_foo( $query ) { if ( ! $query->is_main_query() OR ! is_admin() OR ‘edit.php?post_type=YOUR_POST_TYPE’ !== $GLOBALS[‘parent_file’] // Other conditions that force an abort, Example: // OR ‘foo’ !== $query->get( … Read more

is there a simple way to list every templates / php files used to generate a specific page?

WordPress does not really track what theme files are loaded beyond some basic things (for example $template global holds main template file). You can use PHP’s native get_included_files() to list all PHP source files loaded during request and narrow it down to your theme. Note that for more complex themes this will have not only … Read more

Extending WC_Cart in woocommerce

Extending WooCommerce cart class is a bit tricky, but possible. Lets assume you have a plugin and a file class-my-wc-cart.php with extended cart class inside. Then in the main plugin file you need to do following: // load your My_WC_Cart class require_once ‘class-my-wc-cart.php’; // setup woocommerce to use your cart class add_action( ‘woocommerce_init’, ‘wpse8170_woocommerce_init’ ); … Read more

Load post content into iframe

Not sure, but I think ajax solution would be more apropriate. But anyways, if I understand this corectly, you have an archive where full posts are loaded inside iframe. If this is a case you can modify template file (single.php) and remove header and footer take a look at Template Hierarchy for further reading I … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)