Custom template for post type not working

get_post_format and get_post_type are completely different. Post Formats can be one of the following: ‘standard’ (default one) ‘aside’ ‘chat’ ‘gallery’ ‘link’ ‘image’ ‘quote’ ‘status’ ‘video’ ‘audio’ And shopping is the post type you have created and not post format. You can add post format for the post type(shopping) like this add_post_type_support( ‘shopping’, ‘post-formats’ );

get_terms parent for current product only

get_terms relates to getting all the terms of a taxonomy. get_the_terms grabs all the terms related to the post. The problem is that it sounds like you only want to return those terms which are parent categories, not the children, and get_the_terms does not pass an arguments array. $terms = get_the_terms( get_the_ID(), ‘product_cat’ ); foreach … Read more

Pagination for custom query on single.php

Well, for anyone else looking to solve a similar problem, I found this post, and it led me in the right direction: http://wordpress.org/support/topic/pagination-on-singlephp-causing-301-redirect?replies=9. I added this snippet of code to my functions.php, and I can paginate in custom queries without issue on single.php now. I don’t know enough about it to know what it does, … Read more

How to get category id in single.php wordpress?

Use wp_get_post_categories() Retrieve the list of categories for a post. <?php wp_get_post_categories( $post_id, $args ) ?> Be aware that the function returns an array (of category ids) even if you only have one category in your post. The example below shows how categories are retrieved, and then additional information is retrieved for each category. $post_categories … Read more

Add inline style to get_the_category_list

get_the_category_list() does not really have any filters to achieve what you want. You will currently need PHP like preg_replace() to alter the anchor tags. The big issue would be to get the current link’s term object, which in my opinion would turn it into a quite messy procedure. You could however write your own function … Read more

if is_singular array not working as expected

You are using an incorrect check here. is_singular() returns true when a post is from the specified post type or post types or the default post types when none is specified. You cannot target specific single posts with is_singular() You have to use is_single to target a specific post if ( is_single( ‘post-a’ ) { … Read more

if post id matches these id’s then do this

This looks almost correct. Let’s have a look at is_single(): Works for any post type, except attachments and pages… So if the given ID isn’t that of a page or attachment post type then you can use the function as so: if( is_single( 2578 ) ) { /* … */ } else { /* … … Read more

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