Run Function if Order Meta Exists – WooCommerce

WooCommerce orders are posts and behave the same as any WordPress post. So you can use the same WordPress functions to update or read the post meta data. <?php $meta_values = get_post_meta($post_id, $key, $single); ?> For your example I’d suggest: $match_order_meta = get_post_meta( $order->ID, ‘My_Checkbox’, TRUE); The ‘TRUE’ flag tells WordPress to return the value … Read more

Developing a WordPress plugin like a component in Joomla

Prepare your custom widget, template function or shortcode. By template function I mean something like this: <?php function the_my_template_function(){ ?> <div>My content printed out</div> <?php } ?> which a WordPress user will call from it’s theme by inserting this piece of code into his theme: <?php the_my_template_function(); ?> It’s a common approach.

FancyBox JS stopped working on multiple sites. Custom plugin responsible. Urgent help needed

The Problem is that you include jQuery 1.9, in which the jQuery.browser was removed. Look at your functions.php, you will find a line in there saying wp_register_script or wp_enqueue_script with the parameter ‘jquery’. The URL you are loading jQuery from is ‘http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js‘, and you have to change it to ‘http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js‘. Please ask your developer to … Read more

how can authors to define custom pages?

You can do the following: <?php $post = $wp_query->post; $options = get_option( ‘sample_theme_options’ ); $authors = explode( ‘,’, $options[‘sometext’] ); if ( is_author( $authors ) ) { include ( TEMPLATEPATH . ‘/brand.php’ ); } else { include ( TEMPLATEPATH . ‘/customauthor.php’ ); } ?> This way, you’re always sure that $authors contains an array.

Theme Functions run a function upon activation or preview

Try if ( isset($_GET[‘activated’]) && $_GET[‘activated’] == ‘true’ || isset($_GET[‘preview’]) && $_GET[‘preview’] == 1 ) instead of if ( $_GET[‘activated’] == ‘true’ || $_GET[‘preview’] == 1 ) Edit: You should wrap the if-sentence in the functions.php file into a function and a relevant hook. Here is an example using the after_theme_setup hook: add_action(‘after_theme_setup’,’my_theme_setup’); function my_theme_setup(){ … Read more

Override methods in Yoast SEO breadcrumb class

In cases like this, open the plugin files in a good code editor and search for the elements you need, as there may be an useful hook. So, for this we have the filter wpseo_breadcrumb_single_link. Maybe you can replace span for li in $link_output, or use $link to build your own: add_filter( ‘wpseo_breadcrumb_single_link’, ‘filter_breadcrumb_wpse_88254’, 10, … Read more

Trying to get property of non-object wordpress error message

Given that the page works if you leave the original query alone, your solution is pretty simple. Leave the original query alone. You don’t need to overwrite that query in order to created secondary loops. Instead of this: query_single(‘dealers’, ‘publish’, ‘1’, $taxtype, $value); if (have_posts()) : while (have_posts()) : the_post(); You want: $myq = new … Read more