automatically create taxonomy with same name as post title
Can you not just call get_the_title() to get the title of the Country Story? $cat = get_the_title($post_ID);
Can you not just call get_the_title() to get the title of the Country Story? $cat = get_the_title($post_ID);
There’s the “tax_query” argument available since the latest wp release: global $query_string; $args[‘tax_query’] = array( array( ‘taxonomy’ => ‘status’ ,’terms’ => array( ‘available’, ‘pending’ ) // change to “sold” for 2nd query ,’field’ => ‘slug’ ), ); $args[‘post_type’] = ‘listing’; parse_str( $query_string, $args ); $avail_n_pend = query_posts( $args ); if ( $avail_n_pend->have_posts() ) : while … Read more
Most unfortunate, while my original solution was elegant I did not foresee this complication, and I apologise for the inconvenience. So, I provide an alternative solution. Firstly to get your fancy search query: Your markup will need to change, but this will intercept the URLs and rewrite them correctly internally, it is similar to the … Read more
The problem seems to be in the checks you are performing in the php function that handles the ajax reguest. The first if condition checks if both categoryfilter1 and categoryfilter2 properties are set the the $_POST, and then you have else. Your code will never enter else because, from what I can see, you will … Read more
In order to rewrite a custom post type’s URL, or permalink, you’ll need to filter the ‘post_type_link’, which is run whenever get_permalink() is called, allowing you to change a post’s permalink. I’ve include some guide code below. It seems like you have a handle on the rewrite rules but let me know if you need … Read more
I believe checking in_the_loop will work for the main query: function custom_title( $title ) { global $post; $text=”Extra text: “; if ( get_post_type( $post->ID ) == ‘custom_post_type’ && in_the_loop() ){ return $text . $title; } else { return $title; } } add_filter( ‘the_title’, array($this, ‘custom_title’ ) );
This is accomplished by _wp_auto_add_pages_to_menu() (in \wp-includes\nav-menu.php) function that is hooked to transition_post_status hook. Unfortunately it is hardcoded for page post type and is not easy to extend. On other hand since it works through generic hook it isn’t hard (relatively, menus internal code is pain) to engineer analogue for custom post type.
You could add a hidden input into the page to pre-set the title field, because it won’t be on the page(because the type doesn’t support titles). Slug is produced from the title, so you should only need add a title value. Something like this should work(though untested).. add_action( ‘submitpost_box’, ‘hidden_type_title’ ); function hidden_type_title() { global … Read more
There seems little point in creating a new post entry for each of your products if your table of products already has all of the information you wish to display. Your best bet is to create a single page for example “Product” and then setup your own rewrite rule, using add_rewrite_rule, so that you can … Read more
The issue is that you are declaring a same ID for every DIV in the LOOP. What you need is to do something like this: <ul id=”slider2″> <?php $args = array( ‘post_type’ => ‘jobs’, ‘posts_per_page’ => 15 , ‘order’ => ‘ASC’ ); $loop = new WP_Query( $args ); $i = 0; ?> <?php while ( … Read more