Force WordPress to only match URL in category
Force WordPress to only match URL in category
Force WordPress to only match URL in category
Why are you using SQL when there is our Codex! Use this code snippet instead- function pre_change_query( $wp_query ) { $wp_query->set(‘meta_key’, ‘package_id’); $wp_query->set(‘orderby’, ‘meta_value’); $wp_query->set(‘order’, ‘DESC’); // or ‘ASC’ } add_filter(‘pre_get_posts’, ‘pre_change_query’); $args = array( ‘post_type’ => ‘estate_agent’, ‘posts_per_page’ => 10 ); $my_custom_query = new WP_Query( $args ); See Codex for details: https://codex.wordpress.org/Class_Reference/WP_Query
your theme will have certain templates, that will render pages in certain ways. see template hierachy , you could remove these (the default behaviour is to then resort to index.php, from their you could add some redirect rules for any mention of ‘tag’ or ‘category’ to redirect to another page. This could, though, ruin your … Read more
You can use wp_get_post_terms() to pull the terms. $taxonomy = ‘project-category’; $terms = wp_get_post_terms( $post->ID, $taxonomy); var_dump($terms); wp_get_post_terms() will return an array of terms because multiple terms may be assigned to a single post. This means that you will potentially get a set of terms, not just one, so you will need to choose which … Read more
If you don’t want to supply your own page templates and using your current code is not a possibility (because of how the loop loops through all the posts) I would recommend prompting the plugin users to select a page on which they want your plugin’s content displayed (as an option on your plugin’s setting … Read more
There are no rewrite rules generated for post formats specific to post type. If you want pretty URLs for post type specific post formats, you need to add them yourself. // post_type doesn’t seem to work, // add rules to set custom query var function resource_post_formats_urls() { add_rewrite_rule( ‘resource/type/([^/]+)/?’, ‘index.php?post_format=$matches[1]&resource_only=1’, ‘top’ ); // pagination add_rewrite_rule( … Read more
WordPress core (as expressed by involved people on multiple occasions) strongly discourages sort by terms. It sees terms as exclusively grouping mechanism, with no ordering capabilities implied. So in your specific case WP would understand that there are different directors, that there are groups of shows done by those directors, but won’t at all understand … Read more
Imported Content Doesnt Show Up On Frontend
Seems to me the desire to use that page-builder plugin has resulted in a solution far more complicated, laborious, and convoluted than whatever you’re calling the “long and manual way” 😛 . WordPress itself answers your question. WordPress Philosophy Pages are for static, timeless, and potentially hierarchical content. Plugins abuse that notion sometimes, but never … Read more
The function you want is get_the_terms. $terms = get_the_terms( get_the_ID(), ‘equipment_type’ ); if ( $terms && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { echo $term->name; } }