WordPress: Custom post type with no single page

I am using wordpress as cms for a small website and i do not have a great deal of experience with wordpress. I am trying to create a custom post type with no single.php layout.

On the homepage of design of the website, there is a ticker that displays … “Latest news” – I am able to create a custom post type, loop through it and display all news on the homepage. However this is leading to unintentional creation of links of each individual news item. Which i don’t need.

Read More

How do i get rid of it? – is there a way to have custom post type with no “permalink” URL?

i searched google for the issue and seems like only way is to just use forced url redirection. But i wanted to know if there is a better way to achieve my goal?

is there anything else other than custom post types that can be used?

Related posts

Leave a Reply

2 comments

  1. If you are infact talking about linkable titles from your loop output then @JP Lew is correct. Remove the tag from the loop.

    In addition:
    The post type will show up on your sitemap and they will be crawled by search engines. You must use a robots.txt file and include:

    User-Agent: *
    Disallow: /wp-content/plugins/
    Disallow: /custom_type/
    

    to tell bots to forget about directories that do not contain content like these custom post types and wp-content areas like the plugins directory. Also within your register_post_type() function’s arguments the ‘public’ argument should be set to false for several related reasons including exclusion from WordPress search results, wp-admin etc.

  2. in your homepage template you will find something like this:

    <h2>Latest News</h2>
    <ul>
    <?php
        while ( have_posts() ) : the_post();
    
            ?>
            <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            <?php
    
        endwhile;
    ?>
    </ul>
    

    Just get rid of the anchor tag linking to the the_permalink and you should be good to go. No need to “disable” the URL, just don’t display it in your theme.