WordPress.org

Ready to get started?Download WordPress

Forums

Spun
[resolved] How to remove "Private" text from private posts? (4 posts)

  1. Bellerephon1
    Member
    Posted 1 year ago #

    Hi Caroline!

    First, let me say what a great theme you've made, it's beautiful!

    I have a question.

    I want to use the home page as my "menu" of sorts. I am an author and I need multiple links within a "post" that link to a secondary page, which, since it is writing, will be static.

    Can I make a "page" or "post" within a post that doesn't show up on the home page or in the menu bar?

    I've tried to make the final post "private" but then it has the large PRIVATE text in front of the title. Is there any way to get around this?

    Thanks so much!

  2. Bellerephon1
    Member
    Posted 1 year ago #

    Whoops!

    Fixed this one already.

    I posted this text:

    function the_title_trim($title) {

    $title = attribute_escape($title);

    $findthese = array(
    '#Protected:#',
    '#Private:#'
    );

    $replacewith = array(
    '', // What to replace "Protected:" with
    '' // What to replace "Private:" with
    );

    $title = preg_replace($findthese, $replacewith, $title);
    return $title;
    }
    add_filter('the_title', 'the_title_trim');

    into my Theme Functions.php file. Worked like a charm. Thanks again!

  3. Bellerephon1
    Member
    Posted 1 year ago #

    Okay that ALMOST worked.

    I didn't realize I was being allowed to view the posts which were "private" because I was logged into wordpress.

    my website:HERE

    The POETRY section is a good example of what I would like the pages to look like, with links inside that link to the actual page.

    SO...is there a way to have a post "published" but not viewable, or a way to hide the post until I link to it?

    Any help would be appreciated, thanks!

    P.S. I have tried the "Exclude Page" widget which removes the page from the page widget but the page still shows up in the main menu. So halfway there, but I still need to remove the page from the main menu.

  4. Bellerephon1
    Member
    Posted 1 year ago #

    I GOT IT!

    I feel like a crazy person having a conversation with myself on this forum, but there you have it.

    To remove the page from the main navigation menu, I pasted this code in my style.css sheet.

    page-item-23 {display: none;}

    23 is my PageID number, so you need to replace that number with whatever your PageID is. Of course you have to do it for every page, but it works.

    So, this way you can make a page Public without it showing up in your main navigation - but if you have a link to it in another page it will show up no problems.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.