Add Spans to links

Forums Forums Menus Add Spans to links

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #923
    chrissp26
    Member

    Hello,

    First let me thank you for releasing such a useful plugin.

    I’ve successfully installed the plugin but want to customise the list items as tabs with rounded top corners.

    To do this I will need 3 elements, two of which are availble by default.

    I need the <li> for the horizontally repeating background image.

    I need the <a> tag for the top left background corner image.

    And I need a third tag i.e. a <span> within the <a> tag on the top tier of links to createh the right corner of the tab.

    I have edited core.php to include spans in the generated links.and this works for everything apart from pages.

    ‘If I have a page (a default page is ‘about’) then the span isn’t outputted.

    I’m obviously missing adding a span somewhere. Any ideas?

    #6659

    You don’t need span tags … https://geek.hellyer.kiwi/demo/test/buttonized_dropdown/

    You can create those via the premium CSS dropdown generator … https://geek.hellyer.kiwi/premium_support/

    #6660
    chrissp26
    Member

    Thanks for the response and the example you supplied, but I need the spans in there. Is there no a way for me to add the spans to page links?

    Thanks again for the help.

    #6661

    I have no idea how to do that sorry.

    What do you need the span tags in there for?

    #6662
    Anonymous
    Member

    I am also trying to add a span tag to the menu items. My reason is the same: using styling that uses the span to put a endcaprounded corner on menu items.. I am a newbie in general and have hacked my way into core.php. I think a method might be to do like..

    $pages = pixopoint_menu();
    $pages = preg_replace(‘%<a ([^>]+)>%U’,'<a $1><span>’, $pages);
    $pages = str_replace(‘</a>’,'</span></a>’, $pages);
    echo $pages;

    But this is not working. Any ideas?

    #6663
    moutonnoir
    Member

    Hello!

    I want to second the thanks for the great plugin. However! I am also trying to add span tags to the menu output. This is to achieve a sliding door style menu. I have tried to understand core.php, but my PHP skills are bad. I have been working with this idea: It may help the other poster also.. Any help would be greatly appreciated!

    I suppose I could try to create an additional DIV and move the span styling to the div… Looking for advice to learn a solution, if not a working solution.
    Thanks!
    <?php $pages = pixopoint_menu();
    $pages = preg_replace(‘%<a ([^>]+)>%U’,'<a $1><span>’, $pages);
    $pages = preg_replace(‘/title="([^>]+)"/’, ”, $pages);
    $pages = str_replace(‘</a>’,'</span></a>’, $pages);
    echo $pages; ?>

    <?php unset($pages); ?>

    #6664

    Can you give me an example of what you are trying to achieve that requires span tags? I suspect you are just doing it wrong.

    There are some situations that require the span tags, but they’re fairly rare and can usually be done better without the spans.

    #6665
    moutonnoir
    Member

    I hate to publicly post a work in progress, but here is the link to the development server. You can see my partially integrated Pixo Menu on the word ‘services’

    The Home, Profile, and news sections are hardcoded..

    Is there a way to post formated code on the forum?

    <code> Code test </code>

    #6666
    moutonnoir
    Member

    You can see I have some CSS trouble with the drop down, and the colors are all wrong.. I think I can fix that stuff.

    The real problem is that due to the css from the off the shelf theme relying on span tags for the menu. Try as I might, I cannot quite understand the menu completely. I may soon start a test header and CSS file and rebuild the thing from scratch avoiding the proprietary premium theme code..

    I am currently trying to get firePHP to work with Firebug so I can try to debug the value of $pages during my string replace code. I suppose an easier way might be to add a debug CSS class and have it put messages at the bottom?

    #6667

    SPAN tags are unnecessary for that. You would only use SPAN tags if you wanted to allow it to expand and contract vertically. But your graphics only expand and contract horizontally.

    Just like the demo I posted above:
    https://geek.hellyer.kiwi/demo/test/buttonized_dropdown/

    #6668
    Anonymous
    Member

    I would like span tags also; it might not be ideal in every case but it does make it easier to do more complex CSS. So, my question is, what’s the big deal about providing some easy solution to the problem?

    #6669
    Anonymous
    Member

    You should be able to insert span tags by editing core.php and then look for any function calls to wp_list_pages; there are parameters called link_before and link_after. (Google for usage) after modification should look like wp_list_pages(‘link_before=<span>&link_after=</span>&title_li=…

    #6670

    You could also write a plugin which filtered the wp_list_pages() function itself so that extra <span> tags were added.

    &quot;ecropolis&quot; wrote:
    So, my question is, what’s the big deal about providing some easy solution to the problem?

    I don’t have time to write custom plugins for free. I’m happy to do that sort of thing if you sign up for our Premium Support option though … https://geek.hellyer.kiwi/services/premium-support/

    #6671
    Anonymous
    Member

    Adding [code:1cc1ic49]link_before=<span>&link_after=</span>&[/code:1cc1ic49] worked for me:

    I replaced all

    [code:1cc1ic49]wp_list_pages(‘title_li=&’.get_option...[/code:1cc1ic49]

    with

    [code:1cc1ic49]wp_list_pages(‘link_before=<span>&link_after=</span>&title_li=&’.get_option...[/code:1cc1ic49]

    #6672

    Thanks for the hack Jamie <img decoding=” title=”Smiley” />

    A better solution would be to use the "Auto theme support" option in the plugin, then write another plugin which filtered the wp_page_menu() function to add those SPAN tags in.

Viewing 15 posts - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.