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 🙂
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>’;
}
?>
Why are you using the empty single quotes inside is_category()
??
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.
ok, could you mail me the complete page you’re trying to use this in? (wordpress[at]illutic[dot]nl)
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>’;
}
?>