GetSimple Support Forum
QUESTION condition: if page exists, show link - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: QUESTION condition: if page exists, show link (/showthread.php?tid=10546)



condition: if page exists, show link - VIPStephan - 2018-06-29

I have a simple website with a pretty static menu (not using the get_navigation function for reasons). Now, I would like to add a preliminary link that is automatically hidden if the page isn’t existing yet, and once the page is created it will be visible. How can I do this? Something like:

PHP Code:
<?php if(page_exists('example')) { ?>visible only if the page with the slug “example” exists<?php ?>

And also, independent of this: is there a way to retreive page URLs dynamically? Currently I’m doing something like
PHP Code:
<a href="<?php get_site_url(); ?>example">Example</a
where the page slug is “example”. But what if my site settings are changed, for example, to add a different extension to pages via mod_rewrite? I’d like something where the correct URL is output automatically; I’m imagining something like “get_permalink('example')” where it would print either “index.php?id=example” or “example.php” or whatever, depending on the permalink settings. Is this possible?


RE: condition: if page exists, show link - Carlos - 2018-06-30

1. A couple ways to do it, here: http://get-simple.info/forums/showthread.php?tid=9580&pid=59923#pid59923

2. Example function here: http://get-simple.info/forums/showthread.php?tid=9496&pid=59532#pid59532