Show custom category archive as front page and remove taxonomy slug from urls

Question

I have an art portfolio site in development.

I have used CPT UI to set up:
post type: works
taxonomy: mediums
mediums: paintings, etc

The best way I could think to set this up was to use taxonomy-medium.php as the archive/template for displaying these custom posts.

This is working fine with the following code:

<?php if ($posts) : ?>
    <!-- Slider main container -->
    <div class="swiper mySwiper">
        <!-- Additional required wrapper -->
        <div class="swiper-wrapper">
            <!-- Slides -->
            <?php foreach ($posts as $post) :
                setup_postdata($post) ?>
                <div class="swiper-slide"><?php the_content(); ?></div>
            <?php endforeach; ?>
        </div>
    </div>


    <!-- If we need pagination -->
    <div class="swiper-pagination"></div>

    <!-- If we need navigation buttons -->
    <div class="swiper-button-prev"></div>
    <div class="swiper-button-next"></div>

<?php wp_reset_postdata(); ?>

<?php endif; ?>

Now I want to clean up the UI by doing 2 things.
First, I would like to remove the custom taxonomy slug from urls, changing it from
https://site.dev/medium/paintings to https://site.dev/paintings
I’ve tried several plugins that claim to do this and none worked.

Next I would like to forego a landing page, and just have https://site.dev/paintings as the front page, showing the content from the archive page code shown above.

I have looked through many answers to both these questions, and have not been able to find a working solution. If I set a page with:

<?php locate_template( 'taxonomy-medium.php', TRUE, TRUE ); ?>

it loads the slider but returns no posts. Ideally I would also like the home url to redirect to https://site.dev/paintings so that clicking on menu item paintings shows the same url.

0
WP Shala 2 months 2022-12-03T08:08:30-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse