Forums

[resolved] list bookmarks (7 posts)

  1. hunink89
    Member
    Posted 3 years ago #

    I've got the following working fine:

    <?php wp_list_bookmarks('categorize=1&category_before=

  2. &category_after=
  3. &before=<li class="invinsible">&after=') ?>

    But now i want the next part working. Normally i could use the _$GET function, but for some reason i'm making a mistake with that. Someone help me out? What should be on the place of 'WHAT SHOULD BE HERE' in the following code?

    <?php
    if($_GET['cat'] != ""){

    echo wp_list_bookmarks('include="WHAT SHOULD BE HERE?"&before=<li class="link_total">&after=&title_after=</h3>&title_before=<h3>&show_description=1&between=');

    } else {

    echo '<p>Op deze pagina vind je bestanden die jou docent voor je op internet heeft gezet. Kies links je leerjaar. Daarna kun je kiezen voor je niveau, je klas of algemene bestanden.</p>
    <p>Lukt iets niet of heb je vragen? Neem contact op met je docent!</p>';
    }
    ?>

  • Hiranthi
    Member
    Posted 3 years ago #

    First of all: ubb-code doesn't work here, you should use normal HTML (as stated below the textarea), or use the buttons above the textarea.

    --------------------

    global $wp_query;
    $cat_obj = $wp_query->get_queried_object();

    if ( is_category() ) // opgevraagde pagina is een categorie
    {
    echo wp_list_bookmarks('include='.$cat_obj->cat_ID.'&before=<li class="link_total">&after=&title_after=</h3>&title_before=<h3>&show_description=1&between=');
    }
    else // opgevraagde pagina is geen categorie
    {
    }

    Something like that should work :)

  • hunink89
    Member
    Posted 3 years ago #

    Illutic, thanks a lot, i've got the idea that this should work. But for some reason it doesn't. I copied it almost exact from your post and it looks like this:

    <?php
    global $wp_query;
    $cat_obj = $wp_query->get_queried_object();
    if ( is_category('') )
    {

    echo wp_list_bookmarks('include='.$cat_obj->cat_ID.'&before=<li class="link_total">&after=&title_after=</h3>&title_before=<h3>&show_description=1&between=
    ');

    } else {

    echo '<p>Op deze pagina vind je bestanden die jou docent voor je op internet heeft gezet. Kies links je leerjaar. Daarna kun je kiezen voor je niveau, je klas of algemene bestanden.</p>
    <p>Lukt iets niet of heb je vragen? Neem contact op met je docent!</p>';
    }
    ?>

  • Hiranthi
    Member
    Posted 3 years ago #

    Why are you using the empty single quotes inside is_category() ??

  • hunink89
    Member
    Posted 3 years ago #

    I was wondering if that should solve the problem, but it doesn't.

    If ik make this:

    global $wp_query;
    $cat_obj = $wp_query->get_queried_object_id();
    var_dump($cat_obj);

    Then the output is NULL, while it should be linkcat-16 (where 16 can be anything). So that means that something goes wrong in the frist two lines. But what? I searched some documentation on the functions bu can't figure out.

  • Hiranthi
    Member
    Posted 3 years ago #

    ok, could you mail me the complete page you're trying to use this in? (wordpress[at]illutic[dot]nl)

  • hunink89
    Member
    Posted 3 years ago #

    Thanks to illutic it's fixed now. For those who are interested here's the code:

    <?php
    //var_dump($_GET[ 'cat' ]);
    $_GET[ 'cat' ] = substr( $_GET[ 'cat' ], strlen('linkcat-') ); // linkcat- wordt van $_GET[ 'cat' ] afgehaald en deze variabele is nu alleen een getal
    //var_dump($_GET[ 'cat' ]);

    if ( ( isset( $_GET[ 'cat' ] ) ) && ( is_numeric( $_GET[ 'cat' ] ) ) ) // $_GET[ 'cat' ] is beschikbaar en het is een getal
    {
    echo wp_list_bookmarks('category='.$_GET[ 'cat' ].'&before=<li class="link_total">&after=&title_after=</h3>&title_before=<h3>&show_description=1&between=
    ');
    }
    else
    {
    echo '<p>Op deze pagina vind je bestanden die jou docent voor je op internet heeft gezet. Kies links je leerjaar. Daarna kun je kiezen voor je niveau, je klas of algemene bestanden.</p>
    <p>Lukt iets niet of heb je vragen? Neem contact op met je docent!</p>';
    }
    ?>

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags