How do I nofollow this type of PHP code?
05-28-2009, 04:29 AM
|
How do I nofollow this type of PHP code?
|
Posts: 4
Name: Sebastian
|
Quote:
<?php
function get_main_menu($pre = '')
{
$output = '<ul>';
$args = 'title_li=&echo=0';
$defaults = array(
'depth' => 0,
'show_date' => '',
'date_format' => get_option('date_format'),
'child_of' => 0,
'exclude' => '',
'title_li' => __('Pages'),
'echo' => 1,
'authors' => '',
'sort_column' => 'ID'
);
$r = wp_parse_args( $args, $defaults );
$pages = get_pages($r);
$output .= wp_list_pages('title_li=&echo=0&sort_column=ID&inc lude=2,3,4,5,6,7');
//$output = str_replace('<ul><li', '<ul><li id="li-first"', $output);
$output = str_replace('>' . $pages[0]->post_title . '<', '>' . '<span>HOME</span>' . '<', $output);
$output = str_replace('>' . $pages[1]->post_title . '<', '>' . '<span>BLOG</span>' . '<', $output);
$output = str_replace('>' . $pages[2]->post_title . '<', '>' . '<span>SEARCH MLS</span>' . '<', $output);
$output = str_replace('>' . 'Buying Tucson Homes' . '<', '>' . '<span>BUY</span>' . '<', $output);
$output = str_replace('>' . 'Selling Tucson Homes' . '<', '>' . '<span>SELL</span>' . '<', $output);
$output = str_replace('>' . 'Tucson Resources' . '<', '>' . '<span>TUCSON RESOURCES</span>' . '<', $output);
$output .= '</ul>';
//$output = str_replace(get_permalink(4), 'http://mls.tredaily.com' , $output);
return $output;
}
?>
|
Hey Folks,
I'm not the savviest when it comes to tech coding so I have to ask for your help. I'm only used to applying nofollow to <a href=> tags, and I have no idea on how to implement it on the code above.
I would like to implement nofollow onto these lines only:
$output = str_replace('>' . 'Buying Tucson Homes' . '<', '>' . '<span>BUY</span>' . '<', $output);
$output = str_replace('>' . 'Selling Tucson Homes' . '<', '>' . '<span>SELL</span>' . '<', $output);
$output = str_replace('>' . 'Tucson Resources' . '<', '>' . '<span>TUCSON RESOURCES</span>' . '<', $output);
How do I go about doing that?
---
And another thing that I need nofollow-ed is this:
<?php mdv_recent_posts(2, '<div class="color-block">', '</div>', true, 0, false, false)?>
These are the two most recent posts on my blog and I'd like to have them nofollowed.
---
I tried searching Google for nofollow-ing outputs but I kept coming across sites that are talking about Drupal. I tried putting the pieces together with the listed examples, but after an hour of trying I believe I'm better off getting help from a professional.
I thank you for your help in advance.
-Seb
|
|
|
|
05-28-2009, 08:47 AM
|
Re: How do I nofollow this type of PHP code?
|
Posts: 79
Name: Ed Barnett
|
I've not come across "nofollow" before. What is it?
|
|
|
|
05-28-2009, 03:17 PM
|
Re: How do I nofollow this type of PHP code?
|
Posts: 4
Name: Sebastian
|
Nofollow is used to page sculpt, to tell S.E. spiders which pages should not be given link juice and such.
Pages that you don't need to have ranked in the search engines, you nofollow them.
|
|
|
|
05-28-2009, 06:16 PM
|
Re: How do I nofollow this type of PHP code?
|
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
|
You can't do it in this code. The links are being created by the wp_list_pages so you'd need to rewrite that WordPress function. However that's not a good idea so you can try a plugin like Page Lists Plus instead.
|
|
|
|
05-28-2009, 06:24 PM
|
Re: How do I nofollow this type of PHP code?
|
Posts: 4
Name: Sebastian
|
vangogh,
thank you so much for your help. this is the answer that i've been looking for!
but with the two most recent posts that appear on my homepage, do you know the way to nofollow these?
<?php mdv_recent_posts(2, '<div class="color-block">', '</div>', true, 0, false, false)?>
i don't want to be sending link juice to these recent posts from my homepage.
any tips?
Last edited by sebastiankim9; 05-28-2009 at 06:26 PM..
|
|
|
|
05-28-2009, 06:42 PM
|
Re: How do I nofollow this type of PHP code?
|
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
|
Is that a recent posts plugin? The line of code you posted doesn't look like it does anything with the links. It would have to be someplace else. However if you change the code through the plugin you're likely going to add nofollow to every recent post.
Is there a reason why you want to add nofollow to the links? I wouldn't worry too much about sending link juice to posts from your home page. It's too easy to micromanage when you probably don't need to be so concerned.
If you do want to add nofollow I'd search for some plugins. There's likely one out there that will do what you want.
|
|
|
|
05-28-2009, 07:45 PM
|
Re: How do I nofollow this type of PHP code?
|
Posts: 4
Name: Sebastian
|
Hey Van Gogh,
yes, it's a recent posts plug in. i should've realized that. i'll find a way to work that.
but i just want to micromanage now because that's the one of the few resorts I have left. I have a website with major links coming into me, and i'm still being beat out by stupid websites that' have been grandfathered in from the past. all they have are link farm links, and they still remain in the top of google.
it's my last resort... just tryna keep all the power in the home field..
|
|
|
|
05-29-2009, 05:32 PM
|
Re: How do I nofollow this type of PHP code?
|
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
|
I guess if you've tried other things and want to give PR sculpting a shot there's nothing wrong with. Just be careful, since you can do some damage.
|
|
|
|
|
« Reply to How do I nofollow this type of PHP code?
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|