Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have added a section in my website where I show the logos of my customers. To do so, I have created a category named customers and have published a few posts of this category.
I don't have a problem with showing the posts (The thumbnail and the title of the post) in the website. But these posts must not have single views for 2 reasons.

1. I don't want to have a customer single page because I have no details to put there.
2. This will affect the website's SEO rank.

What I have tried:

I have used a code block like below to show the logos of the customers:

<?php if (get_field('website')) : ?>
    <a href="<?php the_field('website')?>" title="<?php the_title();?>">
        <img src="<?php echo $image[0]; ?>" class="img-fluid d-block mx-auto" alt="customerImage" width="200" height="200">
    </a>
<?php else: ?>
    <a href="<?php the_permalink(); ?>" title="<?php the_title();?>">
        <img src="<?php echo $image[0]; ?>" class="img-fluid d-block mx-auto" alt="customerImage" width="200" height="200">
     </a>
<?php endif ?>


I know that using the code above, will not allow the user to go to the single view of the customer by clicking on their logo (the href a the a tag refers to the customer's website which is a custom field; not the post's url) but as I will have a category page where I'll show all my customers, the single.php for customers must be disabled.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900