Jump to content

Recommended Posts

Posted

I've got a page type field which I use to add a custom content block (page) into my page like so (which just has a title and body field):

// main.php
<?php
    if ($page->insertContentBlock) {
        $block = $page->insertContentBlock;
    }
    else {
        $block = $pages->get("/content-blocks/my-services/");
    }
    echo $block->body;
?>

I'm after a way of hiding the 'Contact me' block because that is always in the footer and never needs to be added to any other area of the page (or it'll be on their twice). You can see in the first screenshot from the tree hierarchy that the page is hidden...

1.png.12c36ccec064ae75361841371c76887d.png

...but still shows up in this menu when editing a page to add a block...

2.png.626f27515e10a2962debb1e9b2dedcb9.png

If I unpublish it, then it does not show in the menu, but this seems like a weird solution. To a client, they would just see 'Contact me', greyed out with a line through it, wouldn't make a great deal of sense. Is there something I can put in the 'custom selector to find selectable pages' that will honour the hidden status of this 'Contact me' page?

3.thumb.png.c4896da919e4824279fa1439c486e726.png

I hope this makes sense. Any advice is appreciated, thanks.

Posted

You can use status!=hidden in your selector, so in "Custom selector..." you'd input something like:

parent=[id of Content Blocks page], status!=hidden

 

  • Like 4
Posted
18 minutes ago, BitPoet said:

You can use status!=hidden in your selector, so in "Custom selector..." you'd input something like:


parent=[id of Content Blocks page], status!=hidden

 

Totally works, you're a gent. Thanks :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...