logo

$7
Query page; remove title hyperlink if excluded from menu.

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: http://wcdco.info/ba

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 this plugin, 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!

West Coast Design Co. | 08/20/10 at 12:39pm | Edit


(3) Possible Answers Submitted...

  • avatar
    Last edited:
    08/20/10
    12:47pm
    Utkarsh Kukreti says:

    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.

  • avatar
    Last edited:
    08/20/10
    12:49pm
    MagoryNET says:

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

  • avatar
    Last edited:
    08/20/10
    1:03pm
    Nilesh shiragave says:

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

    ?>

    Previous versions of this answer: 08/20/10 at 12:58pm

This question has expired.





Current status of this question: Completed