change read more text in archive page depending on post category

With the online php generator I’ve created this code snippet. $post_categories = get_the_category($post->ID); $parent_category_name=””; if (!empty($post_categories)) { $parent_category = $post_categories[0]->parent ? get_category($post_categories[0]->parent) : $post_categories[0]; $parent_category_name = $parent_category->name; } if ($parent_category_name === ‘Apple’ || $parent_category_name === ‘Strawberry’) { echo “<span>Apples &amp; Strawberries</span>”; } else { echo “<span>Fruits</span>”; } It really works fine for me.

How to change the url of the archive page to be inside the custom post type

The has_archive parameter for registering the post type should work (untested): register_post_type( ‘news’, array( … ‘has_archive’ => ‘news/all-news’, ‘rewrite’ => array( ‘slug’ => ‘news’, ‘with_front’ => false, ), ) ); Remember to flush the permalinks by going to Settings > Permalinks and clicking Save button.

Load More : Admin Ajax 400 Bad request, returning 0

You’re using an invalid Content-Type header. x-www-form-urlencoded isn’t a valid content-type. The correct content type is application/x-www-form-urlencoded. Essentially, the web server doesn’t know how to handle the content type you’re giving it to parse the parameters. This is why the request is failing with a 400 because WP is not getting anything in the POST … Read more

Display posts on a custom page from only a specific category?

The argument isn’t category, it is cat. Your query fails because you are using an argument that doesn’t exist. $args = array( ‘post_type’ => ‘post’ , ‘orderby’ => ‘date’ , ‘order’ => ‘DESC’ , ‘posts_per_page’ => 6, ‘cat’ => ‘3’, ‘paged’ => get_query_var(‘paged’), ‘post_parent’ => $parent ); $q = new WP_Query($args); if ( $q->have_posts() ) … Read more

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