<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CSS-TricksCSS-Tricks</title>
	<atom:link href="http://css-tricks.com/wordpress-snippets-page/" rel="self" type="application/rss+xml" />
	<link>http://css-tricks.com</link>
	<description>Tips, Tricks, and Techniques on using Cascading Style Sheets.</description>
	<lastBuildDate>Tue, 21 May 2013 21:24:29 +0000</lastBuildDate>
	<language></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>

	<generator>http://wordpress.org/?v=3.5.1</generator>

	
		<item>
			<title>Spam Comments with Very Long URL&#8217;s</title>
			<link>http://css-tricks.com/snippets/wordpress/spam-comments-with-very-long-urls/</link>
			<comments>http://css-tricks.com/snippets/wordpress/spam-comments-with-very-long-urls/#comments</comments>
			<pubDate>Sun, 28 Apr 2013 13:09:20 +0000</pubDate>
			<dc:creator>Chris Coyier</dc:creator>
				<guid isPermaLink="false">http://css-tricks.com/?page_id=21465</guid>

			<description><![CDATA[<p>Super long URL's are a sure fire sign the comment is spammy. This will mark comments with URL's (as the author URL, not just in the text) longer than 50 characters as spam, otherwise leave their state the way it is.</p>
<code class="language-markup">&#60;?php

  function rkv_url_spamcheck( $approved , $commentdata ) {
    return ( strlen( $commentdata['comment_author_url'] ) &#62; 50 ) ? 'spam' : $approved;
  }

  add_filter( 'pre_comment_approved', 'rkv_url_spamcheck', 99, 2 );

?&#62;&#8230;</code>]]></description>

			<content:encoded><![CDATA[<p>Super long URL's are a sure fire sign the comment is spammy. This will mark comments with URL's (as the author URL, not just in the text) longer than 50 characters as spam, otherwise leave their state the way it is.</p>
<pre rel="PHP"><code class="language-markup">&lt;?php

  function rkv_url_spamcheck( $approved , $commentdata ) {
    return ( strlen( $commentdata['comment_author_url'] ) &gt; 50 ) ? 'spam' : $approved;
  }

  add_filter( 'pre_comment_approved', 'rkv_url_spamcheck', 99, 2 );

?&gt;</code></pre>
]]></content:encoded>

			<wfw:commentRss>http://css-tricks.com/snippets/wordpress/spam-comments-with-very-long-urls/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>

						
		</item>

	
		<item>
			<title>Shrink the Admin Bar / Expand on Hover</title>
			<link>http://css-tricks.com/snippets/wordpress/shrink-the-admin-bar-expand-on-hover/</link>
			<comments>http://css-tricks.com/snippets/wordpress/shrink-the-admin-bar-expand-on-hover/#comments</comments>
			<pubDate>Mon, 25 Mar 2013 21:36:48 +0000</pubDate>
			<dc:creator>Chris Coyier</dc:creator>
				<guid isPermaLink="false">http://css-tricks.com/?page_id=20775</guid>

			<description><![CDATA[<p>A mini plugin:</p>
<code class="language-markup">&#60;?php
/*
 * Plugin Name: Mini Admin Bar
 * Plugin URI: http://www.netyou.co.il/
 * Description: Makes the admin bar a small button on the left and expands on hover.
 * Version: 1.0
 * Author: NetYou
 * Author URI: http://www.netyou.co.il/
 * License: MIT
 * Copyright: NetYou
*/
 
add_action('get_header', 'my_filter_head');
function my_filter_head() { remove_action('wp_head', '_admin_bar_bump_cb'); }
 
function my_admin_css() {
        if ( is_user_logged_in() ) {
        ?&#62;
        &#60;style type="text/css"&#62;
            #wpadminbar {
                width: 47px;
                min-width: auto;
                overflow: hidden;
                -webkit-transition: .4s width;
                -webkit-transition-delay: 1s;
                &#8230;</code>]]></description>

			<content:encoded><![CDATA[<p>A mini plugin:</p>
<pre rel="PHP"><code class="language-markup">&lt;?php
/*
 * Plugin Name: Mini Admin Bar
 * Plugin URI: http://www.netyou.co.il/
 * Description: Makes the admin bar a small button on the left and expands on hover.
 * Version: 1.0
 * Author: NetYou
 * Author URI: http://www.netyou.co.il/
 * License: MIT
 * Copyright: NetYou
*/
 
add_action('get_header', 'my_filter_head');
function my_filter_head() { remove_action('wp_head', '_admin_bar_bump_cb'); }
 
function my_admin_css() {
        if ( is_user_logged_in() ) {
        ?&gt;
        &lt;style type="text/css"&gt;
            #wpadminbar {
                width: 47px;
                min-width: auto;
                overflow: hidden;
                -webkit-transition: .4s width;
                -webkit-transition-delay: 1s;
                -moz-transition: .4s width;
                -moz-transition-delay: 1s;
                -o-transition: .4s width;
                -o-transition-delay: 1s;
                -ms-transition: .4s width;
                -ms-transition-delay: 1s;
                transition: .4s width;
                transition-delay: 1s;
            }
            
            #wpadminbar:hover {
                width: 100%;
                overflow: visible;
                -webkit-transition-delay: 0;
                -moz-transition-delay: 0;
                -o-transition-delay: 0;
                -ms-transition-delay: 0;
                transition-delay: 0;
            }
        &lt;/style&gt;
        &lt;?php }
}
add_action('wp_head', 'my_admin_css');

?&gt;</code></pre>
]]></content:encoded>

			<wfw:commentRss>http://css-tricks.com/snippets/wordpress/shrink-the-admin-bar-expand-on-hover/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>

						
		</item>

	
		<item>
			<title>Insert Images within Figure Element from Media Uploader</title>
			<link>http://css-tricks.com/snippets/wordpress/insert-images-within-figure-element-from-media-uploader/</link>
			<comments>http://css-tricks.com/snippets/wordpress/insert-images-within-figure-element-from-media-uploader/#comments</comments>
			<pubDate>Fri, 12 Oct 2012 15:32:21 +0000</pubDate>
			<dc:creator>Chris Coyier</dc:creator>
				<guid isPermaLink="false">http://css-tricks.com/?page_id=18895</guid>

			<description><![CDATA[<p>For your functions.php file or a functionality plugin:</p>
<code class="language-javascript">function html5_insert_image($html, $id, $caption, $title, $align, $url) {
  $html5 = "&#60;figure id='post-$id media-$id' class='align-$align'&#62;";
  $html5 .= "&#60;img src='$url' alt='$title' /&#62;";
  if ($caption) {
    $html5 .= "&#60;figcaption&#62;$caption&#60;/figcaption&#62;";
  }
  $html5 .= "&#60;/figure&#62;";
  return $html5;
}
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );</code>
<p>It also takes what you enter as a caption and inserts it within the <code>&#60;figure&#62;</code> tag as a <code>&#60;figcaption&#62;</code>. Example inserted code:</p>
<code class="language-markup">&#60;figure id='post-18838 media-18838' class='align-none'&#62;
  &#60;img src='http://youresite.com/wp-content/uploads/2012/10/image.png' alt='Title of image'&#62;
  &#60;figcaption&#62;Caption &#8230;</code>]]></description>

			<content:encoded><![CDATA[<p>For your functions.php file or a functionality plugin:</p>
<pre rel="PHP"><code class="language-javascript">function html5_insert_image($html, $id, $caption, $title, $align, $url) {
  $html5 = "&lt;figure id='post-$id media-$id' class='align-$align'&gt;";
  $html5 .= "&lt;img src='$url' alt='$title' /&gt;";
  if ($caption) {
    $html5 .= "&lt;figcaption&gt;$caption&lt;/figcaption&gt;";
  }
  $html5 .= "&lt;/figure&gt;";
  return $html5;
}
add_filter( 'image_send_to_editor', 'html5_insert_image', 10, 9 );</code></pre>
<p>It also takes what you enter as a caption and inserts it within the <code>&lt;figure&gt;</code> tag as a <code>&lt;figcaption&gt;</code>. Example inserted code:</p>
<pre rel="HTML"><code class="language-markup">&lt;figure id='post-18838 media-18838' class='align-none'&gt;
  &lt;img src='http://youresite.com/wp-content/uploads/2012/10/image.png' alt='Title of image'&gt;
  &lt;figcaption&gt;Caption for image&lt;/figcaption&gt;
&lt;/figure&gt;</code></pre>
]]></content:encoded>

			<wfw:commentRss>http://css-tricks.com/snippets/wordpress/insert-images-within-figure-element-from-media-uploader/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>

						
		</item>

	
		<item>
			<title>Remove Admin Bar For Subscribers</title>
			<link>http://css-tricks.com/snippets/wordpress/remove-admin-bar-for-subscribers/</link>
			<comments>http://css-tricks.com/snippets/wordpress/remove-admin-bar-for-subscribers/#comments</comments>
			<pubDate>Fri, 12 Oct 2012 15:25:54 +0000</pubDate>
			<dc:creator>Chris Coyier</dc:creator>
				<guid isPermaLink="false">http://css-tricks.com/?page_id=18892</guid>

			<description><![CDATA[<p>You might want open registration on your WordPress site so that (for one small example) people can log in and leave comments on things without needing to type their name/url/email every time. But these users probably don't need to see the whole top admin bar as there likely isn't much use in it for them. Although do be sure to provide a link to edit their profile and log out.</p>
<p>This would be for your functions.php file or functionality plugin:&#8230;</p>]]></description>

			<content:encoded><![CDATA[<p>You might want open registration on your WordPress site so that (for one small example) people can log in and leave comments on things without needing to type their name/url/email every time. But these users probably don't need to see the whole top admin bar as there likely isn't much use in it for them. Although do be sure to provide a link to edit their profile and log out.</p>
<p>This would be for your functions.php file or functionality plugin:</p>
<pre rel="PHP"><code class="language-javascript">add_action('set_current_user', 'cc_hide_admin_bar');
function cc_hide_admin_bar() {
  if (!current_user_can('edit_posts')) {
    show_admin_bar(false);
  }
}</code></pre>
]]></content:encoded>

			<wfw:commentRss>http://css-tricks.com/snippets/wordpress/remove-admin-bar-for-subscribers/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>

						
		</item>

	
		<item>
			<title>Allow SVG through WordPress Media Uploader</title>
			<link>http://css-tricks.com/snippets/wordpress/allow-svg-through-wordpress-media-uploader/</link>
			<comments>http://css-tricks.com/snippets/wordpress/allow-svg-through-wordpress-media-uploader/#comments</comments>
			<pubDate>Fri, 12 Oct 2012 00:20:24 +0000</pubDate>
			<dc:creator>Chris Coyier</dc:creator>
				<guid isPermaLink="false">http://css-tricks.com/?page_id=18883</guid>

			<description><![CDATA[<p>For your functions.php file or a functionality plugin:</p>
<code class="language-javascript">function cc_mime_types( $mimes ){
	$mimes['svg'] = 'image/svg+xml';
	return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );</code>
<p>Without this, SVG files will be rejected when attempting to upload them through the media uploader.&#8230;</p>]]></description>

			<content:encoded><![CDATA[<p>For your functions.php file or a functionality plugin:</p>
<pre rel="PHP"><code class="language-javascript">function cc_mime_types( $mimes ){
	$mimes['svg'] = 'image/svg+xml';
	return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );</code></pre>
<p>Without this, SVG files will be rejected when attempting to upload them through the media uploader.</p>
]]></content:encoded>

			<wfw:commentRss>http://css-tricks.com/snippets/wordpress/allow-svg-through-wordpress-media-uploader/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>

						
		</item>

	
</channel>

</rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Content Delivery Network via cdn.css-tricks.com

 Served from: css-tricks.com @ 2013-05-22 05:16:03 by W3 Total Cache -->