Horje
Query page; remove title hyperlink if excluded from menu. - Wordpress Solution
[Solved] - Query page; remove title hyperlink if excluded from menu. - Wordpress Solution
Try following codes
Hello, Situation; 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. Plugin; Currently using a plugin called ‘Exclude Pages from Navigation’ source: [[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. Problem; 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 / If NOT excluded show Title … 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!

Solution - 1

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();
}

?>


Solution - 2

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.


Solution - 3

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>
<?
}
?>

Date: 2022-10-21 05:21:06
Category: Wordpress
More for You