Output parent/child categories and posts in that parent/child hierarchy

You’re right that we need to handle parent-child relationships differently. Let me explain the approach and then show you the code changes needed. The key is to: First get only top-level categories (parent = 0) For each top-level category, check for child categories Display the hierarchy properly in the accordion <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js”></script> <link rel=”stylesheet” href=”https://ajax.googleapis.com/ajax/libs/jqueryui/1.13.2/themes/smoothness/jquery-ui.css”> … Read more

How do I edit this code so that it also adds specific meta data into the user and subsequent CPT being created?

You would use these functions for adding meta: add_user_meta adds user meta add_post_meta adds post meta Notice that wp_insert_post will also return the post ID of the post created ( or a WP_Error object if it failed ). You can then use that in add_post_meta. See https://developer.wordpress.org/reference/functions/wp_insert_post/ Note though that tags/categories are not meta, they … Read more

WooCommerce – how to display product category title above product category images?

1). Copy the Template File Navigate to wp-content/plugins/woocommerce/templates/loop/ Find category.php Copy it to your theme at wp-content/themes/your-theme/woocommerce/loop/category.php 2).Modify the category.php File Open category.php in a code editor and update it to separate the title from the image: <?php /** * The template for displaying product category thumbnails within loops. */ if (!defined(‘ABSPATH’)) { exit; } … Read more

How to determ a custom post type url?

You need to register a custom taxonomy for you custom post type. For example: add_action(‘init’, ‘register_book_taxonomy’); function register_book_taxonomy() { $labels = array( ‘name’ => ‘Book Categories’, ‘singular_name’ => ‘Book Category’, ‘search_items’ => ‘Search Book Categories’, ‘all_items’ => ‘All Book Categories’, ‘parent_item’ => ‘Parent Book Category’, ‘parent_item_colon’ => ‘Parent Book Category:’, ‘edit_item’ => ‘Edit Book Category’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)