Fränk
  • Member for 9 years, 7 months
  • Last seen more than a month ago
Exclude category
Accepted answer
5 votes

To exclude a category, you need to know its ID. You can then exclude it like this (please not the minus before the ID): $args = array( 'posts_per_page' => 4, 'cat' => -the_category_id_to_put_in)...

View answer
How to edit php code in WordPress Post file?
Accepted answer
3 votes

You should never ever modify WordPress Core files. WordPress has an Plugin API (http://codex.wordpress.org/Plugin_API) that allows you to modify WordPress to your liking without changing Core code. ...

View answer
Theme support title tag - how to replace the default WP separator (with a filter)?
Accepted answer
2 votes

You use the document_title_separator filter. So in your case: <?php function theme_prefix_filter_document_title_separator() { return '|'; } add_filter( 'document_title_separator', '...

View answer
Sort posts by custom field numeric value using dropdown
2 votes

You are doing a few things in a not so ideal way. So here is how to solve your problem. 1. Create a category-property.php template file Paste a standard WordPress loop in this file. If you visit the ...

View answer
How to setup a single post page for my custom post type?
2 votes

WordPress uses a naming pattern that determines what template gets used to display a certain kind of content. In your case, all you need to do is create a template file with a standard loop and name ...

View answer
Keeping 'current-menu-item' highlight of navigation menu?
Accepted answer
2 votes

You can target the .current-menu-parent class in your CSS to keep the category highlighted when viewing single posts.

View answer
Wordpress theme options framework, I can't read them in my templates
Accepted answer
2 votes

If you've done everything correctly during the setup, then you should be able to load the logo_image option like this: $my_theme_prefix_option = of_get_option('logo_image');

View answer
Highlight post in sidebar on single page
Accepted answer
2 votes

The simplest thing would be to add a class to the link that contains the post ID. <a href="<?php the_permalink() ?>" class="post-<?php echo get_the_ID(); ?>"> You can then write a ...

View answer
Add a class to post title if a link ends with a certain extension
Accepted answer
2 votes

There is no need to add anything via WordPress, you can simple add the following rule to your CSS file: a[href$='.pdf'] {} This will target all links pointing to a URI ending in .pdf. This works in ...

View answer
Rest API in integration tests - filtering by slug not working?
1 votes

When doing a direct WP_REST_Request, the syntax is not the same as when interacting with the REST API through its HTTP interface. So Kaperto's response was correct. Because WP_REST_Request accepts ...

View answer
How to avoid foreach error WebDevStudio's WDS_Taxonomy_Radio taxonomy metabox class?
1 votes

Upon initialization of the class, you need to pass two parameters: public function __construct( $tax_slug, $post_types = array() ) { So what you need to do is initialize like this: $...

View answer
If child is active add class to parent in customWalker
Accepted answer
1 votes

By default, WordPress applies ancestor classes to the parents of active items. All you have to do is target them via CSS: .nav-menu li.current_page_ancestor > a, .nav-menu li.current-menu-ancestor ...

View answer
Question about "wp_deregister_script()"
Accepted answer
1 votes

The reasons behind this is that these developers are doing_it_wrong. You should never deregister the core version of jQuery and here is why. However wp_deregister_script has its place, for example in ...

View answer
Jquery plugin not working on single pages
1 votes

All the jQuery code in WordPress needs to run in No Conflict mode: http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers So in your case the initialization of the ...

View answer
Choose custom post type template by category
0 votes

Using single.php with conditional template part inclusion for displaying a specific layout for your custom post type is not the right way to do things. WordPress has something called the Template ...

View answer
How to display only taxonomies of custom post type in a page?
0 votes

You can use a taxonomy query, like this: $args = array( 'post_type' => 'recipe', 'tax_query' => array( array( 'taxonomy' => 'types', ...

View answer
bloginfo('template_directory') img src
0 votes

Please note that get_template_directory_uri() is preferred over get_bloginfo('template_directory'). Please refer to this for more information: get_template_directory() vs bloginfo( '...

View answer
contact 7 plugin stops some pages from working properly
0 votes

Try this: function my_theme_prefix_load_javascript() { wp_register_script( 'jquery-defaultvalue.js', get_template_directory_uri() . '/javascript/jquery-defaultvalue.js', array('jquery'), '1.0', ...

View answer
contact 7 plugin stops some pages from working properly
0 votes

It's not the Plugin that is at fault, but the Theme. The Theme enqueues a custom version of jQuery, which you should never ever do. Also when the jQuery plugin is initialized, you need to use ...

View answer
404 on Pages for Custom Post Type & Query_Posts
0 votes

I've battled with a similar problem and came to the conclusion that you can't order by multiple meta values properly using pre_get_posts. However in your case the solution might actually be very ...

View answer
Custom Post Types and archives
0 votes

You need to add the rewrite rules yourself. This code should work: function prefix_this_add_rewrite_rules() { // Add day archive (and pagination) add_rewrite_rule( '/([0-9]{4})/([0-9]{2})/([...

View answer
Custom post type single-{custom}.php not working
0 votes

I copied your code, flushed the rewrite rules via the Admin and now the Theme uses the right templates when I visit a Media Post. You need to flush the rewrite rules once using the after_switch_theme ...

View answer