• I’m using wp_list_pages to build my menu but I want to use a custom graphic for the menu. Right now I have a gif as my menu image and the wp_list_pages menu laid over it:
    https://tinyurl.com/q6dm4

    What I want is some way to hide the text without losing the button function. If I use CSS to set the text to HIDDEN then the button functionality goes away too. I could just do away with wp_list_pages and hard code div boxes for the buttons but I like being able to dynamically change what pages are there. Any thoughts?

Viewing 5 replies - 1 through 5 (of 5 total)
  • but I like being able to dynamically change what pages are there…

    And how would you change “dynamically” the custom image you have there?

    Thread Starter buskerdog

    (@buskerdog)

    I wouldn’t. I would whip it out in Photoshop in about 45 seconds. A lot faster than changing the CSS layout of a bunch of divs.

    But do you have a different suggestion?

    Have you tried – instead of naming the page when you create one (where it asks for the “title”) – putting in the image instead?

    I just did a site not too long ago where I did that for post titles (holy crap, this might work for a site I’m working on right now! Thanks for the brain nudge :)) – I’d imagine it would work for Pages as well…just instead of typing in “title stuff here” I put in <img src="image.jpg" width="100" height="18" alt="title stuff here" />. Worked like a charm for the posts, and the images showed up in place of the text titles.

    Thread Starter buskerdog

    (@buskerdog)

    A very initial test shows that that works. And it shouldn’t mess up permalinks because those use the post slug, right? The only downside is that you’d need to use custom fields or some other method if you want the page title to appear as text anywhere.

    Cool!

    Thread Starter buskerdog

    (@buskerdog)

    Here’s the fix for that:

    Open the template-functions-post.php file in wp-includes and find this line:

    $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '" title="' . wp_specialchars($title) . '">' . $title . '</a>';

    Change it to
    $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page_id) . '">' . $title . '</a>';

    That removes the title tag from the a href and gets rid of the validation errors.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hiding wp_list_pages text without hiding the buttons’ is closed to new replies.