put a list of one post type in other post type to select from it and display selected item in second post type’s single page

I cannot create a complete solution here, because it’s kinda a ‘work for me for free’ question. I can (globally) tell you how to accomplish this. wp-admin –> courses CPT –> add a metabox ‘select teacher(s)’. Collect the teachers with get_posts(). Save the selected teachers as meta, use update_post_meta($course_post_id, ‘assigned_teachers’, $assigned_teachers) in metabox save function. … Read more

How to get all wp_posts in wordpress fetched from database

More explain your question. if you want to fetch all post in database you this code $query = array( ‘post_type’ => ‘my-post-type’, ‘post_author’ => $current_user->ID, ‘post_status’ => array(‘publish’, ‘pending’, ‘draft’, ‘auto-draft’, ‘future’, ‘private’, ‘inherit’, ‘trash’) ); $loop = new WP_Query($query); while ( $loop->have_posts() ) : $loop->the_post();

List all taxonomies with their descriptions

This worked… function list_cats_with_desc() { $base = wp_list_categories(‘echo=0&hide_empty=0&title_li=0&orderby=ID&order=ASC&taxonomy=CUSTOM-TAXONOMY-SLUG’); // wp_list_categories adds a “cat-item-[category_id]” class to the <li> so let’s make use of that! // Shouldn’t really use regexp to parse HTML, but oh well. // (for the curious, here’s why: http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454 ) $get_cat_id = ‘/cat-item-[0-9]+/’; preg_match_all($get_cat_id, $base, $cat_id); // Let’s prepare our category descriptions to … Read more

get taxonomy list in a page in the wordpress

The functions such as get_categories are unique to the post category taxonomy. “Category” is a taxonomy term. If you register your own taxonomies, you need to use get_terms which has similar parameters to your get_categories function. $terms = get_terms(array( ‘hide_empty’ => false, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘taxonomy’ => ‘your-taxonomy’ ));

Why items could not be enclosed within items in WordPress?

You need a shortcode to deal with the removal of the <i> from the editor. You’ll have to add this to your functions.php of your theme/child theme. function dd_fontawesome_shortcode ($atts) { $args = shortcode_atts( array( ‘icon’ => ”, ‘size’ => ’14’, ‘color’ => ‘#000’, ‘type’ => ‘fa’ ), $atts ) ; $output=”<i class=””.$args[‘type’].’ ‘. $args[‘icon’] … Read more

Get children of taxonomies

not actually sure what you are trying to achieve with the code. I would write something like this to get the child terms $terms = get_terms([ ‘taxonomy’ => array(‘Movies, Musics, Books, Games’), ‘parent’ => 0, ‘hide_empty’ => false, ]); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) { foreach ($terms as … Read more

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