Post Query not working

For the type of your $catId, you must use the cat parameter. You can check here the differents parameters allowed. cat (int) – use category id. category_name (string) – use category slug. category__and (array) – use category id. category__in (array) – use category id. category__not_in (array) – use category id.

How to Query in WordPress which shows Alphabetic Posts?

Assuming the letters are links, then put the letter into the URL as a parameter. E.g.: http://example.com/brands/?letter=N Then, in the code (inside whichever template file will be used here), you need to query the DB for posts/brands beginning with ‘N’. You can either create a taxonomy for letters (https://codex.wordpress.org/Function_Reference/register_taxonomy) and assign each post to a … Read more

Custom Post Type to replace Woocommerce products – page not found error

I haven’t tried this myself yet – and I would probably always prefer to go with the default ‘products’ for compatibility reasons… However it should be very well possible to add your own CPT to WooCommerce and then “move” all products to that new CPT. First you’ll have to add a CPT to your WordPress installation that … Read more

Changing CPT slug and taxonomy already registered in parent theme

WordPress 4.5 introduced the functions unregister_post_type() and unregister_taxonomy(). You could deregister your post type respectively taxonomy and register them again with your custom settings. The post type is still named portfolio. You could rename it, but you would probably have to check your template files for references. add_action(‘init’, ‘wpse_247924_overwrite_theme_post_types’, 1000); function wpse_247924_overwrite_theme_post_types() { unregister_post_type( ‘portfolio’ … Read more

Print all the tags from a custom post type

To get the link of any term meta, use get_term_link() function. https://developer.wordpress.org/reference/functions/get_the_terms/ So replace the_permalink() to echo get_term_link($term->term_id); inside your loop. <a href=”https://wordpress.stackexchange.com/questions/248855/<?php echo get_term_link($term->term_id); ?>”><?php echo ‘<p>’ . $term->name . ‘</p>’;?> </a> This link will redirect to tag archive page. Hope this help!