Articles of categories

How to add metabox for post of specific category

I want to add Metabox for the posts of category=18 and i am using the following code but unable to do so . So please help me out-> add_action(‘admin_init’,’my_meta_init’); function my_meta_init() { $post_id = $_GET[‘post’] ? $_GET[‘post’] : $_POST[‘post_ID’] ; // checks for post/page ID if ($post_id->post_category[0] == 18) { add_meta_box(‘team_meta’, ‘My Custom Meta Box […]

Exclude categories from Loop, queries, widgets, post navigation

I recently ha a use case where I needed to prevent a certain category from being displayed in the front-end. In detail I needed to exclude posts assigned to that category from the main query (“the Loop”) search queries category queries archive queries post navigation (next/prev_post_link()) and the category name itself from being displayed as […]

Posts in multiple Categories different single.php

I am smashing my head against some code. Here is the situation: I have one post in 3 different categories, this post has to be visible in “category 1” with the single1.php, in “category 2” with single2.php and in “category 3” with single3.php. Obviously the 3 single.php pages have a different template inside. For example […]

Hook when category is added to post

I’m trying to do something when a category is added to post and saved. I thought that using the save_post hook would have registered when a category is added to a post, but it doesn’t appear to. When I edit a post and do nothing but change the categories for the post, I don’t get […]

How to display regular posts & custom post types that fall under a category using just the generic category template?

1) My site has posts, and 2 custom post types (news & essays) 2) They all share normal categories like sports & health (no custom taxanomy involved) 3) Using the generic category.php template, how do I make it so this template handles all categories while displaying all content falling under it regardless of content post […]

is_category() in pre_get_posts strange error

I have a function that sets posts_per_page option depending on the category viewed. I discovered and error which I can’t really understand: first this is how I get the error: function custom_posts_per_page($query) { if ( !is_admin() && is_category(4)) { // Leaving this empty or with content } } add_filter( ‘pre_get_posts’, ‘custom_posts_per_page’ ); So I get […]

Custom Posts Types using Posts Category

I’m using some custom posts types, and, I don’t wanna create specific categories for each one. I’d like to use the Post Category in all my Custom Post. Here is a example of my new custom posts type: I know how create new category type for my custom posts, but I don’t know how use […]

Remove / Rename Uncategorized Category In WordPress

I have installed wordpress Muilit Site (NETWORK) I need to Remove / Rename Uncategorized Category In WordPress. How is this possible?

How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling

I edited my loop in archives.php in order to work with pagination and with the Category Post List Widget. I basically pieced it all together from random code and ideas and am now so far from the default post query that I’m having trouble getting back to square one. The reason I need to get […]

How to get the url to tag & category base set by the user?

I’m searching for half an hour now on how to get the url/permalink base in WordPress (the ‘category’ and ‘tag’ value set in the backend). Could you please point me in the right direction? I want to dynamically print the following – but only replace the tags and category part (not the tag/category itself): <a […]