• My question is, is there away to make it so when someone creates a new post, it does NOT show up on the main / home page.

    Also, i have this addon page comments enabled on my blog. However, when i go too a page, it does not allow comments.

Viewing 7 replies - 1 through 7 (of 7 total)
  • My question is, is there away to make it so when someone creates a new post, it does NOT show up on the main / home page.

    Yes. What are the criteria to know which posts should not be on the home page?

    Also, i have this addon page comments enabled on my blog. However, when i go too a page, it does not allow comments.

    Most likely you have to add the comment display code to your page.php template file since it is not normally there. The code would be in file single.php It probably needs to be copied into page.php.

    Thread Starter breakdown

    (@breakdown)

    Is it possible to make only administrator made posts only show up on the main page?

    The way I’d approach that is to have all posts you want on the homepage assigned to a category called “Homepage”, and modify the template file that displays your home page (usually index.php but can vary by theme) so it only includes posts from that category when displaying the home page.

    this code goes before the WP loop, if the category id for the homepage category is 5:

    if (is_front_page() ) {
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("cat=5&paged=$paged");
    }

    The unresolved issue so far, I believe, is that you want only admins to be able to assign a post to that homepage category. If all your authors are cooperative and trustworthy, they just don’t use that category and all will be well.

    If you don’t trust the authors in that way, then you need something that prevents any unauthorized author from assigning the homepage category to their posts. That would be a plugin. This is a failry common request on the forum and not sure the great plugin that accomplishes this has been created yet.

    I did not do a complete search of the plugin directory, but in a few minutes came up with this one.
    https://www.ads-software.com/extend/plugins/admin-only-category/
    If the idea seems workable to you, you could try that plugin out, or search the directory for a more complete one. The gist is, it would hide the existence of the homepage category from anyone who is not authorized to put a post on the homepage, so their posts could not appear on the homepage after you add the query_posts code I pasted in above.

    Thread Starter breakdown

    (@breakdown)

    Thank you alot stvwlf, can you tell me what the WP_Loop is? I know its in index.php

    Hi

    Sorry I left that out of the earlier post.
    This is the code I gave you earlier (I also forgot to say that the cat code of 5 is just for example. If you make a Homepage category, instead of 5 use the cat ID of the new Homepage category)

    if (is_front_page() ) {
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("cat=5&paged=$paged");
    }

    Put that code just before the loop, which in most themes starts more or less like this:

    <?php if (have_posts()) : ?>
       <?php while (have_posts()) : the_post(); ?>

    Every theme does it slightly differently, but you are looking for an if (have_posts()) and followed by a while(have_posts()) Put the query_posts before that code.

    Thread Starter breakdown

    (@breakdown)

    It doesn’t work, installed that plugin, which worked fine, it hides the category from regular users. However, inside index.php, i have this :

    if (is_front_page() ) {
      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("cat=12&paged=$paged");
    }
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    However, when a regular user makes a new post, and puts it in another category, it still shows up on the main page.

    Are these posts being displayed on the blog’s homepage – the root WordPress page on your site, or on another page? The query posts code I gave you is for the homepage. If the posts are displaying on a different page the query posts needs to be changed.

    If you can, post the URL of the page in question. If you can’t, post the last part of the URL the posts are displaying on. In other words, if your homepage is https://mydomain.com and the posts are displaying at
    https://mydomain.com/posts/ then “the last part” is /posts/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Posting’ is closed to new replies.