wordpress post_where set only for my costum post type

Please note that the post_Type query variable is not set for standard types (page, post and attachment, see WP_QUery class file line 2396 on trac), only for custom post types, so this is how you can test for each type, add_filter( ‘posts_where’ , ‘posts_where’, 10, 2); function posts_where( $args, $wp_query_obj ) { $type = $wp_query_obj->query_vars[‘post_type’]; … Read more

How can I globally italicize certain text?

Add this into your functions.php file. This is untested, but should work 🙂 add_filter( ‘the_content’, ‘italicize_latin_names’ ); function italicize_latin_names( $content ) { // Split up the content into an array of single words $words = explode( ‘ ‘, $content ); // Loop through each of those words foreach( $words as $key => $value ){ // … Read more

Disable Checkbox depending on state of another checkbox

This may be a little overkill for you needs, but I use a bulked up version of this to great effect on my site. This script will – Check what state the first_option_required option shold be in on page load (and set) Change the state of the first_option_required button upon changes to the first_option_show option. … Read more

Multiple archives to display parent and subcategories content

With the below, you are grabbing terms from the event_category taxonomy Note that you are always grabbing the same terms though. $terms = get_terms( ‘event_category’, array( ‘orderby’ => ‘count’, ‘hide_empty’ => true ) ); If you want to grab only from the current pages children, then you should grab the current term and set your … Read more

Sharing functions between plugins

If you want the theme to be independent from the CPT’s, place the CPT’s as plugin(s). If the CPTs go with the theme, functions.php sounds like the perfect spot for them. If you add them as plugins, you should group them in one or more plugins depending on functionality, not on post type.