Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a website that has a news section which simply shows the most recent 6 posts with a category of news. The problem is that whenever you create a post, Wordpress automatically creates a page for that post. The client claims Google does not like it when you have content showing up on a news section as well as on useless post pages which are not even being linked to.

My question is this: is it possible to duplicate this news section usability (keeping it user-friendly) without having Wordpress create a new post page for every single news item that is published?

And I don't mean just simply excluding the posts from a general post page, because that is already being accomplished. I mean not even generating a page for that post.. That would require a different method (rather than publishing a news item through a post), and I was wondering if said method exists

EDIT:

Thanks to @Rarst, I think I may be getting closer. I performed a test with custom_post_types with the following code:

add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'acme_product',
        array(
            'labels' => array(
                'name' => __( 'Products' ),
                'singular_name' => __( 'Product' )
            ),
        'public' => true,
        'has_archive' => false,
        'rewrite' => array(
            'pages' => false
            )
        )
    );
}

The problem is, I create a new "product" (it should really be "news", but this is just the example provided in the Wordpress documentation), and while it is not archived, a page is still created with the url: http://mydomain.com/?acme_product=test , where 'test' changes based on the name I gave the "product". Is there a way to prevent the site from publishing this page?

Thanks!

share|improve this question
    
if the posts aren't being linked to, how exactly is google crawling them? –  Milo Sep 9 '11 at 3:12
    
Have you looked at custom post types? they are there to help in situations like these. –  Hameedullah Khan Sep 9 '11 at 9:19
    
@Milo: To be honest, I'm not compeltely sure... –  Amit Sep 9 '11 at 17:16
    
@Hameedullah Khan: What do you mean custom post types? What will that allow me to do ? –  Amit Sep 9 '11 at 17:16
add comment

1 Answer

up vote 1 down vote accepted

As per comments see Custom Post Types in Codex.

Essentially:

  • posts are posts of post type;

  • pages are posts of page type;

  • you can register your own custom types to use for your specific needs.
share|improve this answer
    
Would I be able to define a post type that only publishes to the "news" section, but doesn't actually create a page for that post ? –  Amit Sep 12 '11 at 23:08
    
Please see EDIT to question –  Amit Sep 13 '11 at 0:15
    
@Amit well, if you disable archive and not link to those pages they will be essentially invisible. If you want to kill them the easiest would probably be to hook into template_redirect, check for them and redirect to home page or throw 404 error. –  Rarst Sep 13 '11 at 8:53
    
I think that could be a viable solution, how would you hook them into a template_redirect? There's no Wordpress documentation on it. Thanks! –  Amit Sep 13 '11 at 12:18
    
@Amit hooking, well - as hooking usual works. For redirect wp_safe_redirect() and die() –  Rarst Sep 13 '11 at 12:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.