Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION condition: if page exists, show link
#1
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?
Reply
#2
1. A couple ways to do it, here: http://get-simple.info/forums/showthread...3#pid59923

2. Example function here: http://get-simple.info/forums/showthread...2#pid59532
Reply




Users browsing this thread: 1 Guest(s)