• I want to modify the URLs of wp_list_pages; I want to add a #content after the URL, so you skip to that point in the page.

    I would think this is very simple and there are many solutions, but I only found one post on it. I just don’t know how to implement this:

    Can anyone point me in the right direction?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    In stead of wp_list_pages use this:

    <?php
    $pages = wp_list_pages('echo=0');
    echo preg_replace('/\" title=\"/','#content" title="', $pages);
    ?>

    or put this in your theme’s functions.php

    add_filter('wp_list_pages', 'add_to_link');
    function add_to_link($pages) {
            return preg_replace('/\" title=\"/','#content" title="', $pages);
    }

    Thread Starter hannemaatje

    (@hannemaatje)

    Hoera!
    Het is gelukt, dankjewel!

    Moderator keesiemeijer

    (@keesiemeijer)

    You’re welcome.

    Een vraagje aansluitend op dit onderwerp:

    I have the following code:

    <ul id="navigatie_baby">
    <?php wp_list_pages('title_li='); ?>
    </ul>

    And I styled each li with a background like so:

    #navigatie_baby li.page_item{
    	background:url(../images/navigatie/li_menu.jpg) no-repeat 0 ;
     	background-position:0px 0px;
    	width:260px;
    	padding:14px 13px 13px 13px ;
    	list-style-type:none;
    	z-index:0;
    	position:relative;
    	}

    How do I get each background image clickable?

    Currently only the titles are clickable…. their assigned background is not, and kinda stuck.

    Thanks

    Thread Starter hannemaatje

    (@hannemaatje)

    Maybe you could try to display your <a href> tags in your wp-list-pages as block-elements, and then style them as you would your
    <li>, like so:

    #navigatie_baby li.page_item a {
            display:block;
    	background:url(../images/navigatie/li_menu.jpg) no-repeat 0 ;
     	background-position:0px 0px;
    	width:260px;
    	padding:14px 13px 13px 13px ;
    	list-style-type:none;
    	z-index:0;
    	position:relative;
    	}

    Tell me, does this work?

    I cant believe it was that simple haha, thanks so much ??

    Oftewel hartelijk dank ouwe (:

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to modify the URLs of wp_list_pages??’ is closed to new replies.