You are here: Pixo Point Support Forum » General Category » Menus » Add Spans to links

Author Topic: Add Spans to links  (Read 2067 times)

chrissp26

  • Newbie
  • *
  • Posts: 2
Add Spans to links
« on: July 10, 2009, 04:33:44 AM »
  • Reply with quote
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?

Logged

Ryan

  • Administrator
  • Hero Member
  • *****
  • Posts: 3799
    • WWW
Re: Add Spans to links
« Reply #1 on: July 11, 2009, 05:46:49 AM »
  • Reply with quote
You don't need span tags ... http://pixopoint.com/demo/test/buttonized_dropdown/

You can create those via the premium CSS dropdown generator ... http://pixopoint.com/premium_support/
Logged
Available for paid work. Either sign up for Premium Support or use our Contact Page for more information.

chrissp26

  • Newbie
  • *
  • Posts: 2
Re: Add Spans to links
« Reply #2 on: July 13, 2009, 03:47:58 AM »
  • Reply with quote
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.
Logged

Ryan

  • Administrator
  • Hero Member
  • *****
  • Posts: 3799
    • WWW
Re: Add Spans to links
« Reply #3 on: July 14, 2009, 12:38:07 AM »
  • Reply with quote
I have no idea how to do that sorry.

What do you need the span tags in there for?
Logged
Available for paid work. Either sign up for Premium Support or use our Contact Page for more information.

Robert

  • Guest
Re: Add Spans to links
« Reply #4 on: July 15, 2009, 02:52:44 AM »
  • Reply with quote
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 endcap\rounded 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('[/url]','</span>[/url]', $pages);
echo $pages;

But this is not working. Any ideas?
Logged

moutonnoir

  • Newbie
  • *
  • Posts: 5
Re: Add Spans to links
« Reply #5 on: July 15, 2009, 04:08:59 AM »
  • Reply with quote
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('[/url]','</span>[/url]', $pages);
echo $pages; ?>

<?php unset($pages); ?>
Logged

Ryan

  • Administrator
  • Hero Member
  • *****
  • Posts: 3799
    • WWW
Re: Add Spans to links
« Reply #6 on: July 15, 2009, 11:50:16 PM »
  • Reply with quote
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.
Logged
Available for paid work. Either sign up for Premium Support or use our Contact Page for more information.

moutonnoir

  • Newbie
  • *
  • Posts: 5
Re: Add Spans to links
« Reply #7 on: July 16, 2009, 02:38:07 AM »
  • Reply with quote
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>
Logged

moutonnoir

  • Newbie
  • *
  • Posts: 5
Re: Add Spans to links
« Reply #8 on: July 16, 2009, 02:39:32 AM »
  • Reply with quote


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?
« Last Edit: July 16, 2009, 12:52:00 PM by moutonnoir »
Logged

Ryan

  • Administrator
  • Hero Member
  • *****
  • Posts: 3799
    • WWW
Re: Add Spans to links
« Reply #9 on: July 16, 2009, 03:24:10 AM »
  • Reply with quote
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:
http://pixopoint.com/demo/test/buttonized_dropdown/
Logged
Available for paid work. Either sign up for Premium Support or use our Contact Page for more information.

ecropolis

  • Guest
Re: Add Spans to links
« Reply #10 on: December 30, 2009, 01:38:39 PM »
  • Reply with quote
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?
Logged

ecropolis

  • Guest
Re: Add Spans to links
« Reply #11 on: December 30, 2009, 03:19:05 PM »
  • Reply with quote
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=...

Logged

Ryan

  • Administrator
  • Hero Member
  • *****
  • Posts: 3799
    • WWW
Re: Add Spans to links
« Reply #12 on: December 30, 2009, 06:29:27 PM »
  • Reply with quote
You could also write a plugin which filtered the wp_list_pages() function itself so that extra <span> tags were added.

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 ... http://pixopoint.com/services/premium-support/

Logged
Available for paid work. Either sign up for Premium Support or use our Contact Page for more information.

jamie Brewer

  • Guest
Re: Add Spans to links
« Reply #13 on: March 04, 2010, 02:26:44 PM »
  • Reply with quote
Adding
Code: [Select]
link_before=<span>&link_after=</span>& worked for me:

I replaced all

Code: [Select]
wp_list_pages('title_li=&'.get_option...
with

Code: [Select]
wp_list_pages('link_before=<span>&link_after=</span>&title_li=&'.get_option...
Logged

Ryan

  • Administrator
  • Hero Member
  • *****
  • Posts: 3799
    • WWW
Re: Add Spans to links
« Reply #14 on: March 08, 2010, 09:17:46 PM »
  • Reply with quote
Thanks for the hack Jamie :)

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.
Logged
Available for paid work. Either sign up for Premium Support or use our Contact Page for more information.
 

+ Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Name: Email:

Powered by SMF 2.0 RC3 | SMF © 2006–2010, Simple Machines LLC | DSv4 Design by DzinerStudio