-
AuthorPosts
-
October 7, 2014 at 12:43 pm #120730
Jordan BParticipantIs it possible to make rows nofollow?
Ex: The links to articles in a recent posts row.
Could I make that nofollow?
October 7, 2014 at 2:48 pm #120798
Kosher KMemberHi Jordan,
Would you mind providing url of your site for us to check?
Thank you
October 8, 2014 at 6:46 am #121247
Jordan BParticipantgamerapproved (dot) com
October 8, 2014 at 2:18 pm #121573
Nabeel AModeratorHi Jordan,
Thank you for providing us the URL! Regretfully, at this time I am not entirely certain what it is you would like to accomplish based on the information given in your post. If you wouldn’t mind providing us with a little more clarification on what it is you’re wanting to do (a link to a similar example site would be very helpful, or perhaps some screenshots), we’ll be happy to provide you with a response once we have a better understanding of the situation.
October 8, 2014 at 5:25 pm #121732
Jordan BParticipanthttp://scratch99.com/wp-content/uploads/2012/10/limiting-links-header.jpg
I would like to make the other links on my homepage nofollow so search engines focus on my navigation bar.
Links such as
– My buttons
– Links to my recent postsOctober 9, 2014 at 6:41 am #122101
ZeshanMemberHi Jordan,
Thank you for writing in!
It can be done with custom development, but regretfully, it will fall beyond the scope of support we can offer at this time as it will require a lot of template customization. You may wish to consult a developer, or a service like WerkPress or Elto to assist you with this. X is quite extensible with child themes, so there are plenty of possibilities.
Meanwhile, just to make [recent_posts] links nofollow, you can add the following code in your child theme’s functions.php file:
// Recent Posts = No follow links // ============================================================================= function x_shortcode_recent_posts_links_nofollow( $atts ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => '', 'count' => '', 'category' => '', 'offset' => '', 'orientation' => '', 'no_image' => '', 'fade' => '' ), $atts ) ); $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? 'x-recent-posts cf ' . esc_attr( $class ) : 'x-recent-posts cf'; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $type = ( $type == 'portfolio' ) ? 'x-portfolio' : 'post'; $count = ( $count != '' ) ? $count : 3; $category = ( $category != '' ) ? $category : ''; $category_type = ( $type == 'post' ) ? 'category_name' : 'portfolio-category'; $offset = ( $offset != '' ) ? $offset : 0; $orientation = ( $orientation != '' ) ? ' ' . $orientation : ' horizontal'; $no_image = ( $no_image == 'true' ) ? $no_image : ''; $fade = ( $fade == 'true' ) ? $fade : 'false'; $output = "<div {$id} class=\"{$class}{$orientation}\" {$style} data-fade=\"{$fade}\">"; $q = new WP_Query( array( 'orderby' => 'date', 'post_type' => "{$type}", 'posts_per_page' => "{$count}", 'offset' => "{$offset}", "{$category_type}" => "{$category}" ) ); if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); if ( $no_image == 'true' ) { $image_output = ''; $image_output_class = 'no-image'; } else { $image_output = '<div class="x-recent-posts-img">' . get_the_post_thumbnail( get_the_ID(), 'entry-' . x_get_option( 'x_stack', 'integrity' ) . '-cropped', NULL ) . '</div>'; $image_output_class = 'with-image'; } $output .= '<a rel="nofollow" class="x-recent-post' . $count . ' ' . $image_output_class . '" href="' . get_permalink( get_the_ID() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ) . '">' . '<article id="post-' . get_the_ID() . '" class="' . implode( ' ', get_post_class() ) . '">' . '<div class="entry-wrap">' . $image_output . '<div class="x-recent-posts-content">' . '<h3 class="h-recent-posts">' . get_the_title() . '</h3>' . '<span class="x-recent-posts-date">' . get_the_date() . '</span>' . '</div>' . '</div>' . '</article>' . '</a>'; endwhile; endif; wp_reset_postdata(); $output .= '</div>'; return $output; } add_filter('init', function() { remove_shortcode( 'recent_posts' ); add_shortcode( 'recent_posts', 'x_shortcode_recent_posts_links_nofollow' ); });Thanks for understanding. Take care!
October 9, 2014 at 8:03 am #122183
Jordan BParticipantThanks, that’s perfect.
Is there any way to apply this to the buttons?
October 9, 2014 at 12:12 pm #122416
ZeshanMemberHi Jordan,
You can add the following code for buttons shortcode:
// Buttons // ============================================================================= function x_shortcode_button2( $atts, $content = null ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => '', 'shape' => '', 'size' => '', 'float' => '', 'block' => '', 'circle' => '', 'icon_only' => '', 'href' => '', 'title' => '', 'target' => '', 'info' => '', 'info_place' => '', 'info_trigger' => '', 'info_content' => '', 'lightbox_thumb' => '', 'lightbox_video' => '', 'lightbox_caption' => '' ), $atts ) ); $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? ' ' . esc_attr( $class ) : ''; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $type = ( $type != '' ) ? ' x-btn-' . $type : ''; $shape = ( $shape != '' ) ? ' x-btn-' . $shape : ''; $size = ( $size != '' ) ? ' x-btn-' . $size : ''; switch ( $float ) { case 'left' : $float = ' alignleft'; break; case 'right' : $float = ' alignright'; break; default : $float = ''; } $block = ( $block == 'true' ) ? ' x-btn-block' : ''; $icon_only = ( $icon_only == 'true' ) ? ' x-btn-icon-only' : ''; $href = ( $href != '' ) ? $href : '#'; $title = ( $title != '' ) ? 'title="' . $title . '"' : ''; $target = ( $target == 'blank' ) ? 'target="_blank"' : ''; $info = ( $info != '' ) ? 'data-toggle="' . $info . '"' : ''; $info_place = ( $info_place != '' ) ? 'data-placement="' . $info_place . '"' : ''; $info_trigger = ( $info_trigger != '' ) ? 'data-trigger="' . $info_trigger . '"' : ''; $info_content = ( $info_content != '' ) ? 'data-content="' . $info_content . '"' : ''; $lightbox_thumb = ( $lightbox_thumb != '' ) ? $lightbox_thumb : ''; $lightbox_video = ( $lightbox_video == 'true' ) ? ', width: 1080, height: 608' : ''; $lightbox_caption = ( $lightbox_caption != '' ) ? 'data-caption="' . $lightbox_caption . '"' : ''; if ( is_numeric( $lightbox_thumb ) ) { $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, 'full' ); $lightbox_thumb = $lightbox_thumb_info[0]; } if ( $lightbox_video != '' ) { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\""; } else { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\""; } if ( $circle == 'true' ) { $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a></div>"; } else { $output = "<a {$id} class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a>"; } return $output; } add_filter('init', function() { remove_shortcode( 'button' ); add_shortcode( 'button', 'x_shortcode_button2' ); });Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer, or look into service like Elto or WerkPress. X is quite extensible with child themes, so there are plenty of possibilities.
Thanks for understanding.
October 9, 2014 at 1:53 pm #122494
Jordan BParticipantThose two things were actually just the things I needed, thank you!
October 9, 2014 at 3:24 pm #122560
Kosher KMemberGlad to hear that Jordan.
Cheers
September 7, 2015 at 12:04 pm #381183
Bart971ParticipantSorry to bump an old thread, I’m also looking for a way to add nofollow into buttons. I tried to add the code you provided to x-child/functions.php file:
// Buttons // ============================================================================= function x_shortcode_button2( $atts, $content = null ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => '', 'shape' => '', 'size' => '', 'float' => '', 'block' => '', 'circle' => '', 'icon_only' => '', 'href' => '', 'title' => '', 'target' => '', 'info' => '', 'info_place' => '', 'info_trigger' => '', 'info_content' => '', 'lightbox_thumb' => '', 'lightbox_video' => '', 'lightbox_caption' => '' ), $atts ) ); $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? ' ' . esc_attr( $class ) : ''; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $type = ( $type != '' ) ? ' x-btn-' . $type : ''; $shape = ( $shape != '' ) ? ' x-btn-' . $shape : ''; $size = ( $size != '' ) ? ' x-btn-' . $size : ''; switch ( $float ) { case 'left' : $float = ' alignleft'; break; case 'right' : $float = ' alignright'; break; default : $float = ''; } $block = ( $block == 'true' ) ? ' x-btn-block' : ''; $icon_only = ( $icon_only == 'true' ) ? ' x-btn-icon-only' : ''; $href = ( $href != '' ) ? $href : '#'; $title = ( $title != '' ) ? 'title="' . $title . '"' : ''; $target = ( $target == 'blank' ) ? 'target="_blank"' : ''; $info = ( $info != '' ) ? 'data-toggle="' . $info . '"' : ''; $info_place = ( $info_place != '' ) ? 'data-placement="' . $info_place . '"' : ''; $info_trigger = ( $info_trigger != '' ) ? 'data-trigger="' . $info_trigger . '"' : ''; $info_content = ( $info_content != '' ) ? 'data-content="' . $info_content . '"' : ''; $lightbox_thumb = ( $lightbox_thumb != '' ) ? $lightbox_thumb : ''; $lightbox_video = ( $lightbox_video == 'true' ) ? ', width: 1080, height: 608' : ''; $lightbox_caption = ( $lightbox_caption != '' ) ? 'data-caption="' . $lightbox_caption . '"' : ''; if ( is_numeric( $lightbox_thumb ) ) { $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, 'full' ); $lightbox_thumb = $lightbox_thumb_info[0]; } if ( $lightbox_video != '' ) { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\""; } else { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\""; } if ( $circle == 'true' ) { $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a></div>"; } else { $output = "<a {$id} class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" rel=\"nofollow\" {$title} {$target} {$info} {$info_place} {$info_trigger} {$info_content} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a>"; } return $output; } add_filter('init', function() { remove_shortcode( 'button' ); add_shortcode( 'button', 'x_shortcode_button2' ); });then I uploaded and installed the x-child containing the modified functions.php files but nothing changed. My button doesn’t have the nofollow attribute…
Does I need to do anything else?
Thanks in advance
RegardsSeptember 7, 2015 at 12:36 pm #381226
ZeshanMemberHi there,
Please use this code instead for buttons:
function x_shortcode_button2( $atts, $content = null ) { extract( shortcode_atts( array( 'id' => '', 'class' => '', 'style' => '', 'type' => '', 'shape' => '', 'size' => '', 'float' => '', 'block' => '', 'circle' => '', 'icon_only' => '', 'href' => '', 'title' => '', 'target' => '', 'info' => '', 'info_place' => '', 'info_trigger' => '', 'info_content' => '', 'lightbox_thumb' => '', 'lightbox_video' => '', 'lightbox_caption' => '' ), $atts, 'x_button' ) ); $id = ( $id != '' ) ? 'id="' . esc_attr( $id ) . '"' : ''; $class = ( $class != '' ) ? ' ' . esc_attr( $class ) : ''; $style = ( $style != '' ) ? 'style="' . $style . '"' : ''; $type = ( $type != '' ) ? ' x-btn-' . $type : ''; $shape = ( $shape != '' ) ? ' x-btn-' . $shape : ''; $size = ( $size != '' ) ? ' x-btn-' . $size : ''; switch ( $float ) { case 'left' : $float = ' alignleft'; break; case 'right' : $float = ' alignright'; break; default : $float = ''; } $block = ( $block == 'true' ) ? ' x-btn-block' : ''; $icon_only = ( $icon_only == 'true' ) ? ' x-btn-icon-only' : ''; $href = ( $href != '' ) ? $href : '#'; $title = ( $title != '' ) ? 'title="' . $title . '"' : ''; $target = ( $target == 'blank' ) ? 'target="_blank"' : ''; $lightbox_thumb = ( $lightbox_thumb != '' ) ? $lightbox_thumb : ''; $lightbox_video = ( $lightbox_video == 'true' ) ? ', width: 1080, height: 608' : ''; $lightbox_caption = ( $lightbox_caption != '' ) ? 'data-caption="' . $lightbox_caption . '"' : ''; $tooltip_attr = ( $info != '' ) ? cs_generate_data_attributes_extra( $info, $info_trigger, $info_place, '', $info_content ) : ''; if ( is_numeric( $lightbox_thumb ) ) { $lightbox_thumb_info = wp_get_attachment_image_src( $lightbox_thumb, 'full' ); $lightbox_thumb = $lightbox_thumb_info[0]; } if ( $lightbox_video != '' ) { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\""; } else { $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\""; } if ( $circle == 'true' ) { $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a rel=\"nofollow\" class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a></div>"; } else { $output = "<a {$id} rel=\"nofollow\" class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode( $content ) . "</a>"; } return $output; } add_filter('init', function() { remove_shortcode( 'x_button' ); add_shortcode( 'x_button', 'x_shortcode_button2' ); });Thanks!
September 7, 2015 at 12:54 pm #381245
Bart971ParticipantAwesome, this code works! Thanks a lot!
Best regards
September 7, 2015 at 12:57 pm #381250
NicoModeratorGlad to hear that it worked.
Have a great day! 🙂
March 21, 2016 at 2:17 am #845963
UHeuerParticipantI am new at WordPress and the x-theme. Can you give me an instruction where I can paste the code. Thanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-120730 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
