Tips & Tricks
Remove the title attribute using jQuery
In WordPress, when you use wp_page_menu
your anchor attribute’s usually carry a title with the same name. I’m not sure if it’s correct to do this, but it bother me when I hover over a page menu navigation link and I get a hover of the title.
So on my site I used jQuery to remove the title:
$("#nav a").removeAttr("title");
Pretty simple huh?
Tips & Tricks
How to: Display RSS feeds from anywhere
Here is a simple way to display any RSS feed in your WordPress blog.
<?php include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss('http://feeds2.feedburner.com/WPCult'); $items = array_slice($rss->items, 0, 4); if (empty($items)) echo '<li>No items</li>'; else foreach ( $items as $item ) : ?> <a style="font-size: 14px;" href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'><?php echo $item['title']; ?></a><br /> <p style="font-size: 10px; color: #aaa;"><?php echo date('F, j Y',strtotime($item['pubdate'])); ?></p> <p><?php echo substr($item['summary'],0,strpos($item['summary'], "This is a post from")); ?></p> <?php endforeach; ?>
The first step is to include the WordPress file rss.php
then will apply code after to style the feeds.
Of coarse I forgot to mention, change the RSS feed to the feed you want to pull.
Tips & Tricks
How to: Open external links in a new window
Over the weekend, I attended WordCamp Denver, and I was asked by John Hawkins how to force links to open in a new tab with out editing the source code. So, today lets learn a simple jQuery trick to open all external links in your site in a new tab or window. We are going to make sure you have jQuery active on your site, you can do this easily in WordPress, since it’s bundled with the latest installations. Use this code in your header: <?php wp_enqueue_script('jquery'); ?>
then, below the wp_head
add the following:
<script type="text/javacript"> var $j = jQuery.noConflict(); $j(document).ready(function() { //external attribute $j("a:not([@href*=http://YOURSITE.com/])").not("[href^=#]") .addClass("external") .attr({ target: "_blank" }); } ); </script>
That’s it, just make sure you change the http://YOURSITE.com to your website.
Update
If you like you can remove the var $j =
and replace all $j
with simply just $
Themes
Fixing plugins not compatible with hybrid 0.4.2
Hey everyone, as you may have noticed I have a running on the site. While everything almost everything moved over smoothly, there was an issue with how my parent theme striped text in typography. This caused some plugins, like cformsII to not be allowed to print to the screen. Justin had helped to find a fix to filter the hybrid_typography
function.
Originally this function filtered out and changed some text that would not validate as XHTML. This had to be removed by running a new function in the child theme’s function.php
file.
add_action('init', 'remove_typography'); function remove_typography() { remove_filter('the_content', 'hybrid_typography', 11); }
-
Tips & Tricks4 months ago
WordPress Security Hacks
-
Pages4 months ago
Write For Us – Guest Post
-
Tips & Tricks3 months ago
How to: show/hide a widget in WordPress with jQuery
-
Plugins2 months ago
Top Membership plugins
-
Tips & Tricks1 month ago
Limit the characters that display on the_title
-
Tips & Tricks5 months ago
Remove spaces when echoing the_title
-
News3 weeks ago
How to: Show/Hide any div box with jQuery in WordPress
-
Plugins4 weeks ago
How to: Creating an Archive page
Bryan
March 11, 2009 at 9:32 pm
Hey, yeah, that’s really simple! Right now I’m doing…
$clean_pages = wp_list_pages(‘title_li=&&echo=0’);
$clean_pages = preg_replace(‘/title=\”(.*?)\”/’,”,$clean_pages);
echo $clean_pages;
Frosty
March 12, 2009 at 12:55 pm
Yes, a lot easier, but it won’t work on any browser that has javascript disabled.
andy
March 21, 2009 at 11:25 am
correct me if i am wrong please….do i just put this code in my head section:
$(“#div_id”).removeAttr(“title”);
and that should remove the title attribute from displaying when I hover over any item within the #div_id ?
Note: it is not an a tag I am trying to remove the title attribute from, but rather a div tag.
Austin
March 21, 2009 at 2:24 pm
Yes, the removeAttr should remove any title attribute if there is one, as long as javascript is enabled.
Unibands
October 29, 2009 at 5:08 am
Yes, but you of course need the jQuery library too. And you put this like so in your tags.
//
Unibands
October 29, 2009 at 5:12 am
Seems like code etc doesn’t show up in the comments.
Pingback: Remove WordPress Title Attribute | ClayCazier.com