Remove class that has been added by parent theme

If you want to apply a filter to the same content another function has filtered, change the priority argument (which should have been named _execution_order_) to a higher number. So … add_filter( ‘body_class’, ‘my_body_class’, 11, 2 ); … will make sure my_body_class() will be called after another_body_class() that has been registered with 10: add_filter( ‘body_class’, … Read more

Match checkbox data with page title to show certain items

I managed to figure it out myself reading around, solved it with this: <div id=”grid”> <?php $args = array( ‘depth’ => 0, ‘child_of’ => 411 ); $pages = get_pages(array(‘child_of’)); $grid_title = $post->post_title; foreach($pages as $post) { setup_postdata($post); $fields = get_fields();?> <?php if($fields->company_name != “”) : ?> <!– Any new tags will need to be added … Read more

wp_delete_post deletes all posts instead of just expired ones

In case anyone else needs the code, this is how I solved it. @pieter-goosen was right, I did need to query the correct posts, but the real trick was matching the date format from the jquery datepicker when running the post query. Check the date formats below, jquery is ‘yy-mm-dd’, and the php equivalent is … Read more

Create a post variable processing page

You see a lot of code out there which includes wp-load.php or wp-blog-header.php to use the WordPress API within a php page loaded outside the context of WordPress. There’s often a better way to accomplish this. It’s also worth noting that any plugin which does that will get rejected from the WordPress.org plugin repository, with … Read more

Getting movie and serial on actor page

Hy, i resolve a problem, a liitle question, how can i get the text if nothing is selected in custom field ( distributie_serial). Ex: no serial for this actor. This is the Code that works. <?php $seriale = get_posts(array(‘post_type’ => ‘serial’, ‘meta_query’ => array( array(‘key’ => ‘distributie_serial’, // name of custom field ‘value’ => ‘”‘ … Read more

On this day PHP code

Adapted from the Codex, tweaking WP_Query to get all years before this. Untested, but should work. $on_this_day = array( // remove the year from the first query array ‘monthnum’ => date(‘n’), ‘day’ => date(‘j’); ); // Create a new filtering function that will add our where clause to the query function filter_where( $where=”” ) { … Read more

How to stop loading multiple copies of jquery

You should remove these lines from your header.php <script language=”javascript” type=”text/javascript” src=”https://wordpress.stackexchange.com/questions/154191/<?php bloginfo(“template_url’); ?>/javascripts/jquery.js”></script> <script language=”javascript” type=”text/javascript” src=”https://wordpress.stackexchange.com/questions/154191/<?php bloginfo(“template_url’); ?>/javascripts/tabber.js”></script> <script language=”javascript” type=”text/javascript” src=”https://wordpress.stackexchange.com/questions/154191/<?php bloginfo(“template_url’); ?>/javascripts/superfish.js”></script> And instead add the following function in your functions php… right at the top. wp_enqueue_script function sg_theme_js(){ wp_enqueue_script( ‘jquery’ ); wp_enqueue_script( ‘tabberjs’, get_template_directory_uri().’/javascripts/tabber.js’, array(‘jquery’), 1.0, true); wp_enqueue_script( ‘superfishjs’, get_template_directory_uri().’/javascripts/superfish.js’, … Read more