in my multi author website I have a button that users can upload their avatars. I need to display this button in author page. I can do it. I added this button to author page. The problem is that author can see this button in other author's page too . That's why I need to display this button in author page of current user. I am so sorry I have no any reference code. I have no any idea how …
I am using WooCommerce in WordPress. I have few categories of products like these, Example: Product 1 Category (//parent) -- Category 1 -- Category 2 -- Category 3 -- Category 4 Product 2 Category (//parent) -- Category 10 -- Category 11 -- Category 12 -- Category 13 If I am in a archive page for Category 2(sub) How can I get all other category name under the parent category (Product 1 Category) as a list. what i'm trying $args = …
I have set up an archive page for my custom post type reference, where I use a query to get all posts of type reference. This works, but when I try to paginate the result, it doesn't work. Right now, it doesn't even print out the pagination links. EDIT: This was earlier used on a regular page, but I changed it to an archive page. That's when the pagination broke. Here is the source code; Custom post type reference (plugin) …
I am having trouble changing the slug of my archive page. The goal is to create a page that can be edited from the back end of WP with the slug speakers, but that has already been taken by the archive page. This has to be client friendly so it can't be only editable in the php. I am willing to do whatever anyone thinks is the best idea for this. Ideas: removing the archive page all together rewriting the …
Is there a way to get category posts from a certain year? I know how to get all posts posted in a certain year -> www.example.com/**year**/ or with months -> wwx.example.com/year/month (that's how the default archive works) Is there a trick to get for wwx.example/year/category/ Thanks!
I am trying to add pagination for my Archive. I want to show 12 posts per page and then show the 'next' / 'previous' buttons. When I manually change the value of the $paged variable, the 1 into a 2 it works. When I click the Next button on the archive page, it loads a very weird theme page. The url looks like: '/page/2/'. What am I doing wrong? This is the code I wrote so far: <?php global $paged,$wp_query; …
Is there a way to add additional first and last page links to the pagination object if it is rendere with the the_posts_pagination() method? At this point I have the following the_posts_pagination( [ 'screen_reader_text' => ' ', 'mid_size' => 2, 'prev_text' => __( 'vorherige', 'bdb' ), 'next_text' => __( 'nächste', 'bdb' ), ]); and I would like to after prev_text a first page link if is not the first page and a last page link before next_text if is not …
I would like to set up a function in my functions.php file in a theme so that when a custom-post-type is being viewed, if the user clicks the author name in the post, it only shows CPTs by that author, but on the main blog if they click the author name it will only show the blog posts of that author. I already have the author names showing in my custom post and normal post meta and I have an …
I'm trying to create a small code that will display a list of discounted products that belong only to the category of products that the user is on, that is, if the user is on the clothing category page, then the code should display only discounted products from the clothing category, I also want the code to work on the product page. For now, here's what I got. $args = array( 'post_type' => 'product', 'posts_per_page' => '5', 'product_cat' => 'clothes', …
I've followed the code based off this and everything is working perfectly -How to create a permalink structure with custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name So I am able to browse taxonomy archives with my/category (or) my/category/subcategory and view a custom post associated with each term as my/category/subcategory/custompost However, I cannot view my/category/page/2/ or my/category/subcategory/page/2/ It gives me a 404. Here is the code I am using. posttype.my.php function create_my_posttype() { register_post_type( 'my', array( 'labels' => array( 'name' …
I have 2 loops on the archive page. I want the first loop to display the 2 last posts of the category and the second loop offset 2 last post! <div class="top-posts"> <?php if (have_posts()) : while(have_posts()) : the_post();?> <div class="content"> <?php the_post_thumbnail('archive'); ?> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> </div> <?php endwhile;?> <?php endif;?> </div> <div class="primary-posts"> <?php if (have_posts()) : while(have_posts()) : the_post();?> <h2><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></h2> <?php endwhile;?> <?php endif;?> </div>
i want to show image gallery in archives.php or category.php. The featured image and text content is showing but not image gallery. Below is the code inside category.php. I have tested to show one post from category 'blog'. $args = array( 'post_type' => 'post', 'post_status' => 'any', 'cat'=>3, 'meta_query'=> array('relation'=>'AND', array( 'key'=>'intro_post','value'=>'intro','type'=>'CHAR','compare'=>'LIKE' ) ) ); $arr_posts = new WP_Query( $args );?> <?php if ( $arr_posts->have_posts() ) : ?> <?php while ( $arr_posts->have_posts() ) : $arr_posts->the_post(); ?> <div class="entry-content"> <?php if …
I have a custom content type, "products", which shares the category taxonomy with posts. We're using posts to discuss and review products. The idea is to have two separate URLs: /discussion/category/term/ : Displays a listing of posts belonging to a specific term with a "related products" area pulling from the same term /products/category/term/ : Displays a listing of products belonging to that term with a "related discussions" area pulling from the same term I can use the default category/archive templates …
I've seen similar questions posted before but they don't seem to quite fit my problem. I have a post type called product and I have 2 taxonomies, product_cat and location I want archive pages that combine both these taxonomies which would be structured like this /product/product_cat/location I know this can be done with rewrites but I can't figure out how to make it work. Update I've achieved this to an extent using add_rewrite_rule( '^art-classes/([^/]*)/([^/]*)/?', 'index.php?product_cat=$matches[1]&location=$matches[2]', 'top' ); But now my …
I have a WP installation with 6 categories and I want 3 of them to use a custom Category Archive Page called "category-special.php" (default page is the "category.php"). I found the code below that looks to be close to my query, how can I modify and make it work for me, so categories 31,40 and 55 to load the above specific page? add_filter( 'template_include', 'wpsites_photo_page_template', 99 ); function wpsites_photo_page_template( $template ) { if ( is_category('33') ) { $new_template = locate_template( …
I took over a website that was developed by someone else and have rebuilt it to function in Elementor. Everything works great, except for one Archive page with the slug “our-projects” that I can’t seem to edit or access (it is not an existing page and the Trash has been emptied). The problem is I have another Projects page I need to assign the “our-projects” slug to as this slug has a long SEO history. As this Archives Page exists, …
so I am looking into the wordpress REST API for the first time. I have some questions that may sound ridiculous to those that are familiar with it, but i am confused as to how it works. So natively wordpress works by its page query ( wp_query ) to retrieve posts associated with that particular archive. If i was to use the REST API to query posts, on the a particular archive page, does it query all posts in the …
Okay So I'm facing a weird problem as i'm receiving 404 errors on blog category and tag pages. I'm using custom theme which includes: tag.php category.php archive.php home.php index.php and 404.php. The Blog archive is working fine but when i try to load tag pages or category pages i'm being redirected to 404.php template file. Also there is one other weird problem which i'm facing if i remove 404.php file from my theme folder the category and tag links are …
I have custom post type like this register_post_type( 'workforce_archive', array( 'labels' => array( 'name' => __( 'Workforce Archives' ), 'singular_name' => __( 'Workforce Archive' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'workforce_archive'), 'show_in_rest' => true, 'show_in_menu' => false, 'supports' => [ 'title', 'editor', 'author' ] ) ); And also have a file archive-workforce_archives.php but still I am getting 404 page when visit this URL "http://taliestrategies.local/workforce_archives". Any help is appreciated. Thanks
I have a page with a permalink of /news and when i go to that page it redirects me to archive pages. I only want to go my news page and not redirect me to archive. Please help.. thanks