Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Query page; remove title hyperlink if excluded from menu. WordPress

  • SOLVED

Hello,

<strong>Situation;</strong>

Currently querying all sub pages based on a predefined parent ID into a list, it works … however some of those pages the titles will link to the actual page and some, may not because they maybe lacking content.

<strong>Plugin;</strong>

Currently using a plugin called ‘Exclude Pages from Navigation’
<em>source:</em> [[LINK href="http://wcdco.info/ba "]]http://wcdco.info/ba [[/LINK]]

This was before WP 3.0, I really like how easy it for my clients to decided what pages to exclude.

<strong>Problem;</strong>

The question is … how could I build an IF statement that determines if this ‘post’ has been excluded using [[LINK href="http://wcdco.info/ba"]]this plugin[[/LINK]], don’t show <a href="<?php the_permalink() ?>">/

If NOT excluded show <a href="<?php the_permalink() ?>">Title</a> …

In my DB I see a new entry ‘option_id 551’ with a column labeled ‘option_value ‘ that contains my id’s 2,3,4,5,6,7,8,9 etc.

How difficult would this be? Any assistance you can provide would be much appreciated.

Thanks!

Answers (3)

2010-08-20

Nilesh shiragave answers:

If you are referring this post as current page then you have to pass $post->ID.



<?php

$excluded_ids = ep_get_excluded_ids();

if ( !in_array( $post->ID, $excluded_ids ) )

{

?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>

<?

}
else
{
the_title();
}

?>

2010-08-20

Utkarsh Kukreti answers:

You can use something like

$pages = explode(',', get_option("ep_exclude_pages"));

$pages will now have an array of all the page id's (array(1, 2, 3)), that are selected.

2010-08-20

MagoryNET answers:

You could try using ep_get_excluded_ids function from the plugin:


<?php
$excluded_ids = ep_get_excluded_ids();
if ( !in_array( $PAGE_ID, $excluded_ids ) )
{
?>
<a href="<?php the_permalink() ?>">Title</a>
<?
}
?>