how to redirect the link to a category in the website

Hi Im really new to wordpress and this error is really stressing me out everytime I click a link in my category sidebar it redirects me to the homepage any idea on how to resolve this problem this is my sidebar in my news page the url it gives is (websitename)/category/announcements/ the link is correct but the page is wrong Thanks in advance
Category: Web

i need to have a tab with gategory post

i have a custom type named gallerie i need to create a tab with category in each category show ther post . i have this code but didn't work for me ''' <section> <div class="container"> <div class="row"> <?php $gallery_cats = get_terms('gallery-category'); //nav echo'<nav> <div class="nav nav-tabs" id="nav-tab" role="tablist">'; foreach($gallery_cats as $gallery_cat) { echo'<button class="nav-link" data-bs-toggle="tab" data-bs-target="'.$gallery_cat->slug.'" type="button" role="tab" aria-controls="'.$gallery_cat->slug.'" aria-selected="true">'.$gallery_cat->name.'</button>'; } echo'</div></nav>'; //content query_posts(array( 'post_type' => 'gallery', 'gallery-category' => $gallery_category, 'posts_per_page' => 3, )); if(have_posts()) { echo'<div class="tab-content" id="nav-tabContent" data-sort-id="gallery"> …
Category: Web

How to get the last category name of a child category?

there. I've tried tons of solutions I've found in this forum before asking this. It's kind of hard for me to understand the php sintaxe. I have no idea how to do this and i've been stuck for days trying hundreds of codes. Can someone help me? I have the following categories: - Animal -- Dog --- frenchie-1 --- frenchie-2 --- frenchie-3 Animal > Dog > frenchie-3 I need to get the slug from "frenchie-3", that is the last one …
Category: Web

Show parent category wp_list_categories wordpress

For example I have 3 categories: cars, bikes, trucks The category of track has 3 subcategories (childs): man, scania, iveco I want to show on page only subcategories of track category. How can i do that ? This is my code that show all categories and subcategories <?php wp_list_categories( array( 'orderby' => 'name', 'show_count' => true, 'exclude' => array( 10 ) ) ); ?>
Category: Web

Posts arranged by Sub Category in Category page, But not showing non Sub category items

I'm trying to create Category posts under each sub category, that's working but With out sub category items not showing... <?php $categories = get_categories('child_of='.get_queried_object()->term_id); if(!empty($categories)): foreach ($categories as $category) { $category_id = $category->term_id; query_posts('cat='.$category_id."&order=ASC"); if ( have_posts() ):?> <h3><?php echo $category->name; ?><span></span></h3> <ul class="latest-archive"> <?php while ( have_posts() ) : the_post(); ?><li><a href="<?php the_permalink();?>"><?php the_title(); ?></a></li> <?php endwhile;?> </ul> <?php endif;} endif; ?>
Category: Web

Php string not working in Wordpress Functions.php (trying to fetch 1st category for each blog that post appears in the sidebar)

I am trying to fetch 1st category for each blog post that appears in the sidebar of any blogpost landing page. I tried multiple options to add the 2nd block code to the 1st block at the line ".wp_get_post_categories ($post_id)." but I could not find any solution. Please help me with that and if you need closer to the code just let me know. 1st Block $related_blog .="<div class='related-blog'> <div class='row'> <a href=".get_the_permalink()."> <div class='col-lg-4 col-md-4 col-xs-4 blog-image'> <img src=".$image_related[0]."> …
Category: Web

Php string not working in Wordpress Functions.php

How to pass the following code. <div> <?php $category = get_the_category(); ?> <a href="<?php echo get_category_link($category[0]->cat_ID); ?> "> <?php echo $category[0]->cat_name; ?> </a> </div> In the function.php file's following code. $related_blog .="//want to pass the above code here."; For detailed description visit here: click here
Category: Web

How to get category URL with the slug?

I have a variable that contains the slug of a category. With that slug I want to create a link to the archive page that displays all the posts in that specific category. What is the best or fastest way to go from slug to category URL? Preferably I don't want to use a lot of variables (like when going from slug > id > url, each with a different variable). I would like a function that does one of …
Category: Web

Current category link filter

In my theme I have an archive template for a taxonomy (taxonomy-cat_projet.php). In this template I have a list of this taxonomies' links to allow users to select a taxonomy. Here is the code I'm using to list the categories links: <ul> <?php $args = array( 'title_li' => '', 'taxonomy' => 'cat_projet', 'hide_empty' => false, ); wp_list_categories( $args ); ?> </ul> Is there a way (once a category is selected) it's link could change so that if it's clicked it …
Category: Web

How do i bring out post category name in my widget?

I customize the repeat post widget and add little functionalities to it. Everything is working fine but my challenge now is that the widget when used is not bringing out individual post category name. What am I gettin wrong in the widget as it output one post category even though the post link falls into another category. View my site www.wordpress.bestrackservices.com/. I have post in national, economy and others and it keeps showing entertainment even when the post category is …
Category: Web

Showing the category hierarchy as clicked in WordPress, with image and desc

have a very weared issue, i am sure the solution is simple but i am not very used to wordpress and cant figure this out. what i have is a WordPress theme and if needed i can change it to any other docent mater. what i have is i have some category in my wordpress and they have child and the child has child it goes to 4 lavels. like Book -Novel --book name ---chapter 1 ---chapter 2 Article -about …
Category: Web

How to get WooCommerce Product Category Link by ID?

WooCommerce's product categories are a custom taxonomy called product_cat. In a function I'm writing, I'm using get_categories with the taxonomy parameter set to product_cat. Everything works fine and I can get the term id, the name, and even the slug. What I can't figure out is how to get the link to display. Apparently get_category_link doesn't work with custom taxonomy and get_term_link isn't working either, I get an error. Here's what I have: $prod_cat_args = array( 'taxonomy' => 'product_cat', //woocommerce …
Category: Web

Linking to the most recent post in my podcast category

I am attempting to pulloff what the author did here: How can I link to the most recent post in a category? However, after updating my functions.php file in my child theme I can not get it to load the latest post from the podcast category. When I try: http://talkdirtytome.show/podcast/?latest it returns with a list off all the podcast episodes in the podcast category. When I attempt to goto http://talkdirtytome.show/category/podcast/?latest I get a Nothing Found page. I am sure there …
Category: Web

echo $category[0]-> cat_name; shows only one category name

I have this code: <div class="row"> <div class="col-lg-12 post_meta"> <ul> <li> <p class="meta-txt">Category</p> <p class="meta-des"><?php $category = get_the_category(); echo $category[0]-> cat_name; ?></p></li> <li> <p class="meta-txt">Published</p> <p class="meta-des"><?php the_time('F j, Y'); ?> </p></li> <li> <p class="meta-txt"><?php echo get_comments_number(); ?> Comments</p> <p class="meta-des"><?php if (comments_open( get_the_ID() ) ) comments_popup_link( __( 'Leave your thoughts', 'html5blank' ), __( '1 Comment', 'html5blank' ), __( '% Comments', 'html5blank' )); ?></p></li> </ul> </div> </div> It shows only one category as you can see on that link: http://www.migrate2.deniz-tasarim.site/2020/01/10/yazi-9/ …
Category: Web

How-to get the get_category_parents() breadcrumbs trail without link on last item

Just a question : I want to use get_category_parents() to display a breadcrumb on a category archive page, but with no link on the current displayed category (SEO purposes, because they say that's a link to itself. I'm not sure search engines are that stupid, but anyway). Like this : link_home » link_cat1 » link_subcat1 » nolink_subsubcat1 get_category_parents() is perfect for that, but there's only two options : with links and without links. What I want is links BUT on …
Category: Web

Place category Base URL at the end

By default the Categories' URL will show like this: example.com/category/category-name/. In this case we say the category URL base is category. Wordpress allow us to customize the URL base. For example: we can change it to list and our new category URL is going to be example.com/list/category-name/. Nice. I want to change the URL base to the end. So my URL category name now should be: example.com/category-name/list/. How can I achieve that goal?
Category: Web

Creating a linkable category list with post count

I am trying to create a new education site that has two types of resources, courses and informal learning. I am trying to do this without using custom post types or taxonomies. The site with use the same topic categories for both the courses and informal learning, but each post will be identified as a course or information learning. I'm trying to create a list of links to specific topic categories with the number of post in each, but only …
Category: Web

force category base - archive pages work WITH & WITHOUT category base slug in url?

I need any posts of any category (and archive pages) to route through /blog/. I added "blog" to my category base, but now both website.com/blog/my-category/ AND website.com/my-category/ both display the same content. Single posts redirect to website.com/my-category/my-post-name I have Yoast installed, have gone back and forth trying their "remove category base" option, and nothing is working. It's deactivated now while I figure this out. Any idea how to force category, archive, and single post pages to use the category base?
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.