Ecommerce Shopify WordPress Discussion

Stuck on trying to display blog post archives on a custom page template && I can't figure out how to change the URL for each blog post

I'm making a travel blog from scratch using wordpress and developing my own wordpress theme. I'm wanting to give 5 different countries their own page that has its own post archive based on which country you are viewing. e.g. if I'm on the Thailand page, it should show all of the Thailand blog posts. The first bit I'm struggling with is, when I go onto the Thailand page ".../destinations/thailand", it doesn't come up with any posts that belong to the "Thailand" category. but when i navigate to ".../category/thailand", they all show up. My goal is to make each country's blog posts archive display on the country's page url so it looks something like this ".../destinations/thailand" My other issue is making the URL of each blog post change from ".../blog-post-1" to "/destinations.../thailand/blog-post-1" I've created include files with the post loop and called the include file in the custom page i've created, the same way that i would with archive.php file. the posts show when i go to ".../category/blog" but not when i go to ".../destinations/thailand"
It sounds like you're trying to create a custom structure for your travel blog where each country has its own page displaying blog posts related to that country. Let's address the issues you're facing. 1. Displaying Country-Specific Blog Posts: 1.1. Check the Category Slug: Ensure that the category slug for Thailand is "thailand" and not something else. You can do this by going to "Posts" in your WordPress dashboard, editing a post assigned to the Thailand category, and checking the category section to verify the slug. 1.2. Use the Category Template: WordPress automatically looks for a template file based on the category when viewing a category page. Make sure you have a template file named category-thailand.php in your theme directory. This template file will be used when viewing the category page for Thailand. Here's a basic example of what category-thailand.php might look like: <?php get_header(); echo '<h1>Thailand Posts</h1>'; if (have_posts()) : while (have_posts()) : the_post(); get_template_part('content', 'archive'); // Use your post loop include file endwhile; else : echo '<p>No posts found</p>'; endif; get_footer(); ?> Make sure to replace 'content', 'archive' with the actual names of your include file. 2. Changing Blog Post URLs: 2.1. Permalinks Structure: To achieve the desired URL structure, you'll need to update your permalink settings. Go to "Settings" > "Permalinks" in the WordPress dashboard. Choose the "Custom Structure" option and set it to: /destinations/%category%/%postname%/ Check screenshots for more details 2.2. Update Category Links: When displaying links to the Thailand category, ensure you're using get_category_link with the correct category ID or slug: $category_link = get_category_link(get_cat_ID('thailand')); echo '<a href="' . esc_url($category_link) . '">Thailand</a>'; Make sure to adjust these steps based on your specific theme structure and requirements. If you're still facing issues, consider sharing more details about your theme structure or the code you're using, and I can provide more targeted assistance.

December 30, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.