WordPress.org

Forums

Disable/Change the url of the link | wp_list_categories (9 posts)

  1. mediabros
    Member
    Posted 4 years ago #

    Here there,

    wp_list_categories is showing a fine list of my categories.

    1. I want to disable the link by replacing the url g.e.

    <a href="http://urltocat">cat</a>

    into

    <a href="#">cat</a>

    how is this possible? the codex won't tel me

  2. mediabros
    Member
    Posted 4 years ago #

    Still searching for a solution, anyone found something?

  3. mediabros
    Member
    Posted 4 years ago #

    It seems this is the only way to get some attention to my post :)

  4. applesfaceman
    Member
    Posted 4 years ago #

    maybe its just me, and it probably is. but try describing in some more detail what it is youre trying to do, like i said its probably just me, but i dont really know what youre talking about.. disbale the link... what link? detail detail detail..

  5. mediabros
    Member
    Posted 4 years ago #

    Hi Applesfaceman,

    Apologies for not being clear enough than.

    this code

    wp_list_categories('sort_column=name&sort_order=asc&style=list&children=true&hierarchical=true&title_li=0&show_count=0&echo=0&current_category=1');

    prints a list with links of my categories and subcategories like:

    <li class="cat-item cat-item-13"><a href="http://www.website.com/category/multimedia">multimedia</a>

    What i need is:

    <li class="cat-item cat-item-13"><a href="#">multimedia</a>

    So my question is how to make that possible with the wp_list_categories function?

  6. applesfaceman
    Member
    Posted 4 years ago #

    you want to list specific categories relevant to the page the user is on? this sounds like what im trying to do too and have had no luck hopefully your post here will get some lookers and some good ol fashion wp help

  7. mediabros
    Member
    Posted 4 years ago #

    i try to disable a redirection to another page by clicking. on click link > dont go anywhere, stay on current page.

  8. dallasbpeters
    Member
    Posted 4 years ago #

    you ever get it figured out? Im trying to do the same thing. need it for some jquery tab action.

  9. mediabros
    Member
    Posted 4 years ago #

    Yep, figured it out.

    $cat = get_query_var('cat');
    
    foreach(get_categories('parent=0&exclude=15') as $category)	{
    
    echo '<li class="parent-item"><a class="name" href="#">' . $category->name.'</a></li>';
    											}

    hope it helps you!

Topic Closed

This topic has been closed to new replies.

About this Topic