How might I change the destination of a link?
If I understand you correctly, you could create a custom link in the menu (Appearance > Menu > Custom Links). If it is something else, you might find this plugin helpful.
If I understand you correctly, you could create a custom link in the menu (Appearance > Menu > Custom Links). If it is something else, you might find this plugin helpful.
You need to register the Custom Taxonomy BEFORE the Custom Post Type that it belongs to in order for the rewrite rule to work. The taxonomy needs to “exist” before the post type in order for WordPress to build the URL correctly.
Isn’t this easily to be achieved by checking if ?s= is set ? You do have to output the results of this search on the same page, by using the post archive link as action url. if ( isset( $_GET[s] ) { // show posts }
When registering a custom taxonomy, register_taxonomy() accepts an update_count_callback argument. This callback function will be called when the count is updated. The default callback is _update_post_term_count() for taxonomies attached to post types, which confirms that the objects are published before counting them. _update_generic_term_count() is the default for taxonomies attached to other object types, such as … Read more
Please try the following code. I haven’t tested it but it should work. We could use two different loop, one for content and another for navigation insert the navigation later with JS or another way. But in this case, one loop is enough and of course better than two loop. You’ve to add the active … Read more
The ‘proper’ way would be to use add_action() See: https://codex.wordpress.org/Plugin_API/Action_Reference The closest hook for your need would be ‘edit_form_top’ You could do something like this function add_your_button(){ echo ‘<a href=”https://wordpress.stackexchange.com/questions/294025/index.php?param=your-action” class=”page-title-action”>List View</a>’; } add_action(‘edit_form_top’, ‘add_your_button’); That would achieve: The catch is that there is a hr tag after the Add New so your new button … Read more
I suspect the extra slash is coming from the str_replace action because normally there’s no need to manually add slashes when retrieving TAX urls. Since you now end up with 1 unwanted slash, I would recommend testing situations with/without the slash. Starting with removing the one in the function definition. Make it empty, see what … Read more
I’ve been working on a solution this afternoon and have come up with the following. It may not be the most elegant way of doing this though, so I’m open to further comments. function custom_tax_list_and_posts() { $post_type=”CUSTOM_POST_TYPE_NAME”; $taxonomy = ‘CUSTOM_TAXONOMY_NAME’; // Get all of the parent terms in the custom taxonomy and include empty ones … Read more
“’orderby’ => $company_name,” should be “’orderby’ => ‘meta_value’,“ If the value of _company_name is numeric – it should be meta_value_num. Note that ‘orderby’ can only have a predefined value and ordering does it alphabetical See the possible values at the WP_Query orderby parameter: https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters The ordering parameter says: Order alphabetical by the values of meta_key … Read more
One way to do it would be to run two custom queries like this: $normal_post_args = array( ‘post_type’ => ‘post’, ‘category_name’ => ‘hobby’ ); $normal_posts_query = new WP_Query( $normal_post_args ); $movie_post_args = array( ‘post_type’ => ‘movie’, ‘category_name’ => ‘hobby’ ); $movie_posts_query = new WP_Query( $movie_post_args ); echo “Posts (” . $normal_posts_query->found_posts . “)”; echo “Movies … Read more