All Questions

Filter by
Sorted by
Tagged with
0
votes
1answer
20 views

How to get category lists by name or slug

Currently I am able to get all categories but I want only few categories to display based on name or slug for example. $categories = get_categories('accessibility','wcag', 'abc'); is this possible ?...
1
vote
1answer
26 views

Highlight “Show all” item in wp_list_categories

I use wp_list_categories to display category filters on post archives. I can use current_category param to set current category - and such item will get addition class current-cat. I can even omit ...
0
votes
1answer
24 views

Archieve.php not loading for custom post type

I have a post with a category of blog . So i came across with this archieve.php , whereby we can edit the layout and content of a custom post type. From what I understand archieve.php contains the ...
1
vote
1answer
319 views

How to get data about category in category.php

I have to make custom category.php template, but how do I get data about category in category.php? I need these: Category name and id Category's parent name and id All category's items Let's say our ...
0
votes
1answer
16 views

How to show some of category in wordpress

I listed all category in front page with get_categories() function But i dont want show all category in output For example i dont want show catgegory with id=25 How to should i do that? This is my ...
1
vote
1answer
45 views

Why category.php throw 404 in wordpress while calling paginate_links()?

I am trying to develop my own Wordpress theme and want to add pagination in category page by call paginate_links() function. It will generate the links [1,2,... Next] perfectly but when I click on 2 ...
8
votes
1answer
481 views

Display random categories on the front page (Finding and Editing Theme Functions)

I'm Currently in the alpha stages of editing a child theme for a Wordpress theme. I do have programing experience and some experience managing wordpress but no direct experience editing wordpress ...
0
votes
1answer
536 views

Inside a loop, how to change CSS class based on category name?

This is my first post here. I am struggling with a new situation for me, as a WP Developer. I have a loop that lists some posts. These posts can be published in different categories. I need to ...
0
votes
1answer
36 views

Allow user to select categories that will display in post loop

I am building a simple theme from scratch (really just for fun, and for the purpose of learning about WordPress development) but I have an idea I want to implement. I have built a page template that ...
0
votes
1answer
51 views

Insert HTML content in WP Query at specific point

I have a category page with an if ( have_posts() ) : ?> loop and would like to insert HTML content after the nth post. I've done this previously with a WP_QUery using an if( $query->...
0
votes
1answer
111 views

Media Library Categories

I am using the following to assign categories to my WordPress Media Library (in functions.php): function wptp_add_categories_to_attachments() { register_taxonomy_for_object_type( 'category', '...
1
vote
1answer
30 views

editing fonts of category links from the_category() funtion

I have multiple pages using content-featured.php I'm having trouble pasting the code.. that file uses the_category function The_category function displays names/links of categories. I'm having ...
-1
votes
1answer
34 views

How can i hide the authors box from a specific set of categories and post types?

I want to just hide the authors box under the posts for few specific categories, while on the rest it will remain visible as is.
0
votes
1answer
39 views

How do I retrieve the category ID (ugly permalinks) in my sub-navigation menu?

I have recently faced multiple issues with a theme developed with in mind pretty permalinks when moving back to ugly ones (for a number of different reasons). Had issues that I resolved with ...
1
vote
2answers
294 views

Recent Posts Not Showing Only On A Specific Category Page [closed]

On my blog, for some reason, one of the category pages refuses to load new posts even when I clear all my caches. I'm using WP Super Cache (W3 Total Cache broke my site), Autoptimize and Cloudflare ...
0
votes
3answers
53 views

Give posts a particular template based on the assigned category

I have the following setup: 3 posts: post1, post2, & post3 2 categories: cat1 & cat2 2 templates: singe1.php & single2.php post1 and post2 are assigned to cat1 post3 is assigned to cat2 ...
-1
votes
2answers
2k views

How to display the category featured images [closed]

I have a custom theme that for the latest posts displays the posts thumbnail. What I am looking to do is to check and if there is no thumbnail set then use the category's featured image. I could ...
1
vote
1answer
351 views

How to check category of of custom post type or not

I have a category.php file in my theme. Now the problem is in wordpress category can be of many things. Like there is a default blog post category. Then there are category for custom post types, like ...
1
vote
1answer
39 views

Set a them for all subset of category

I know I can set a theme template for any category , which sets the name of php file like this: category-16.php But there are many subsets for my category16. I want that template set for all of ...
0
votes
2answers
47 views

Breaking Categories Up into Individual Divs

I've been working with the wp_list_categories( $args ); to display categories from a taxonomy and I feel that this might be the wrong method to use. Now I'm wondering if it is possible to instead of ...
5
votes
3answers
232 views

How to build a complex page structure

Let's say i need a page structured like the image below. There is a frontpage and from there i can choose one of the sites partners. Every partner gets a additional "partner page" which has to be ...
0
votes
1answer
423 views

Help with Multi Level Category Archive Page

I'm currently building a site for a local beauty salon and I have come across an issue that I just cannot seem to put my finger on and I have been stuck on this for weeks, where I'm stuck is with the ...
1
vote
1answer
853 views

How can I display recent posts from a particular category in my header?

Question: Category Display I'm trying to create a header that pulls data from the most recent 3 posts in a specific category along with pulling the image associated for the most recent post (if there ...
0
votes
1answer
70 views

How can I add HTML classes for current taxonomy/term hierarchy into my pages to simplify styles?

I've tried posting each of these questions to the Wordpress forum, but I'm not getting responses. Hopefully, someone here can assist me. Question: Catgory/Subcategory Styling I'm trying to style all ...
1
vote
3answers
977 views

Check if loop has any categories?

In my loop, I have ten posts with the following categories (slug): group-a, group-a-first and group-b. The loop/query looks like this: Post (group-a) Post (group-b) Post (group-a-first) What's the ...
0
votes
1answer
252 views

Change single.php template based on parent category

I have the following code working but with split() being depreciated and not available in php 7, I need some help. The idea here is this code is inserted in my single.php (in child theme). When a ...
1
vote
1answer
327 views

Custom category code not showing all posts

I have a PHP template I am applying to several pages on my site so that they show a list of all posts in a category with the same name as the page. However, this is not working correctly in that posts ...
0
votes
1answer
396 views

Category page returns 404 error

I'm developing custom theme that should show all categories on a single page in /category path. When i navigate to /category/some-category, i can see all posts that belong to that category, but when ...
0
votes
1answer
5k views

How To Display Category list from Portfolio post type plugin?

I'm new from WordPress development. I want to display portfolio category list in my theme, I'm useing portfolio post type plugin what must I do ? what code or WordPress function must implement in my ...
1
vote
1answer
1k views

WP_Query arguments to fetch custom post type posts which are in certain category?

I've played around for hours but still can't wrap my head around the right arguments for a secondary WP_Query which shall fetch all posts of my_custom_post_type that are in the queried category. ...
1
vote
2answers
2k views

Template tags to display custom post type posts in category template?

I am developing a custom theme with custom post types involved. Custom post types have been defined via plugin 'Pods' (http://pods.io). When writing a category.php, I realized, that the standard loop ...
1
vote
1answer
3k views

Mark menu item as current-menu-item for category

I have some categories on my WP website. When users sees this categories and posts from them i want to mark one of menu items as active. How can i set one of my menu items to have class "current-menu-...
0
votes
2answers
47 views

Question on using custom structures for categories

Im trying to create a topics "section" similar to what Justin Tadlock has on his site but i'm not sure how he is doing this. Categories? Tags? or what? I tried changing the Category base to topics as ...
0
votes
1answer
61 views

Show posts from all categories

I have a site with 5 different categories, each of them with a notices section. I would like also to have another section to see the latest notices from any category. So far, I figured out that I can ...
4
votes
5answers
21k views

Check if current category has subcategories

I have found the following piece of code in the WP Knowledge Base theme in order to show subcategories of a parent category. The problem is that this only works for the first level of hierarchy, so I ...
2
votes
1answer
1k views

Custom HTML structure in wp_list_categories

I am trying to accomplish an Ajax navigation for the categories and for that I need the code to look something like: <ul> <li data-level="1">Parent Category</li> <li data-...
0
votes
0answers
369 views

If it is a top level category show children otherwise show sibling categories

I found a great piece of code for my category.php file to list categories for a specific taxonomy (not tested). BUT - how can I change the code (or achieve it) to show the default Wordpress categories ...
0
votes
1answer
34 views

Lowest catagory link

I am trying to display lowest child category link.At this point I can only display the child category name but I want it with permalink.So far my approach $categories = get_the_category($post->ID);...
0
votes
1answer
2k views

the_category() tag not styling HTML or CSS

I am having problems getting my the_category() template tag to style accordingly with the rest of my theme. I believe this is because the HTML isn't output the same way as the the_author() and ...
1
vote
2answers
1k views

Apply different Class for each element in a foreach()

sorry for the silly question, but I am really lost. I want to apply the following CSS to the even elements of my foreach. CSS .blogArticles a { float: left; max-width: 250px; width: 25%; ...
1
vote
2answers
2k views

Why adding Categories does not auto refresh in Backend while using my custom theme?

If I am using my own created custom theme, the Post Categories Page in admin panel is not getting updated automatically when I add a new Category. To see the new category I have to reload the page ...
0
votes
2answers
68 views

Show post categories

I'm trying to show post categories for some breadcrumbs. At the moment, I have this: the_category(' / ', 'multiple'); But for some reason, it is stating the parent category twice (I only want parent ...
0
votes
1answer
31 views

Add description to categories menu in admin

I'm trying to create a simple paragraph above the categories menu, on the post editor page. Most of the tutorials I see are adding input meta values, and not in relation to the categories. What's the ...
1
vote
1answer
2k views

Retrieve all posts within tag OR category?

I've created a simple loop. And I have the following array for the query: $live_tags = array( 'tag' => 'live', 'showposts' => 5, 'post_type' => 'post', 'post_status' => '...
0
votes
1answer
2k views

filter a loop base on specific category

i am going to filter my loop base on the category the problem is that when i am using the following code it display all my post. // Query args $custom_cat_args = array( 'posts_per_page' => 15, ...
0
votes
1answer
128 views

Problem with multiple loops in wordpress theme

I am using multiple loops like this <?php $posts = get_posts('numberposts=1&order=DESC&orderby=post_date&category='.get_cat_ID( 'سیاست' )); foreach ($posts as $post) : ...
2
votes
3answers
4k views

wp_update_nav_menu_item() to insert categories

In the script below, I'm attempting to dynamically add categories to a custom menu. Everything works great, except for the fact that the categories do not have hyperlinks. What am I missing in ...
0
votes
1answer
411 views

How to show post from category select

This code is in my functions.php: array( "name" => "Headline", "type" => "section"), array( "type" => "open"), array( "name" => "Headline Categories", "desc" => "Choose a category ...
0
votes
3answers
143 views

Having some trouble properly displaying Custom Post Types in templates

I have a child theme of Twenty Thirteen and I've setup Custom Post Types for several items. They are showing up in the Dashboard, I can create the Custom Posts and they show up in various categories ...
0
votes
0answers
91 views

How to get multiple loop in category.php, my scripts becomes madness

I am trying to develop a category.php page for my new theme and the loop which I’ve developed shows all posts of my blog and really bad too. I'm not an expert in WordPress theme development and ...