<?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>scriptygoddess &#187; WordPress Hacks</title>
	<atom:link href="http://www.scriptygoddess.com/archives/category/wordpress/wordpress-hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptygoddess.com</link>
	<description></description>
	<lastBuildDate>Thu, 08 Dec 2011 18:23:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress edit_post_link doesn&#039;t display (fix)</title>
		<link>http://www.scriptygoddess.com/archives/2011/02/15/wordpress-edit_post_link-doesnt-display-fix/</link>
		<comments>http://www.scriptygoddess.com/archives/2011/02/15/wordpress-edit_post_link-doesnt-display-fix/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 20:46:49 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress: Lessons Learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1673</guid>
		<description><![CDATA[I recently ran into this problem &#8211; and I see an old thread on the forums about this. The last post there says to make sure you&#039;re logged in. (I can assure I was). But, that&#039;s not what was causing the problem. Here are the steps that got me to the problem: Set up a [...]
Related posts:<ol>
<li><a href='http://www.scriptygoddess.com/archives/2011/02/09/wordpress-emails-being-sent-by-usernamebox-bluehost-com-fix/' rel='bookmark' title='WordPress emails being sent by {username}@box###.bluehost.com (fix)'>WordPress emails being sent by {username}@box###.bluehost.com (fix)</a> <small>If you are hosted on Bluehost and you&#039;re using WordPress,...</small></li>
</ol>

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I recently ran into this problem &#8211; and I see an <a href="http://wordpress.org/support/topic/edit_post_link-wont-show-up">old thread on the forums</a> about this. The last post there says to make sure you&#039;re logged in. (I can assure I was). But, that&#039;s not what was causing the problem. Here are the steps that got me to the problem:</p>
<p>Set up a new WordPress install. Logged in. Among a few other changes, I also changed the path for the site URL in the general settings to be the domain root (rather than the directory where WordPress was installed). I had made a custom theme with &#034;edit this page&#034; links&#8230; but they weren&#039;t showing up.</p>
<p>The reason: when I logged in the first time, the &#034;admin&#034; cookie that was set was specific to the directory where I installed WordPress &#8211; and did not apply to the root domain where it was now pointed. Since that change happened AFTER I was already logged in, WordPress did not update my cookie to include the root directory &#8211; so those pages could not see that I was in fact logged in.</p>
<p>The simplest fix is to log out and then log back in &#8211; which should set your cookies appropriately.</p>
<p>Related posts:<ol>
<li><a href='http://www.scriptygoddess.com/archives/2011/02/09/wordpress-emails-being-sent-by-usernamebox-bluehost-com-fix/' rel='bookmark' title='WordPress emails being sent by {username}@box###.bluehost.com (fix)'>WordPress emails being sent by {username}@box###.bluehost.com (fix)</a> <small>If you are hosted on Bluehost and you&#039;re using WordPress,...</small></li>
</ol></p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2011/02/15/wordpress-edit_post_link-doesnt-display-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simulate Breadcrumb Navigation with Hierarchical Custom Taxonomies</title>
		<link>http://www.scriptygoddess.com/archives/2010/11/19/simulate-breadcrumb-navigation-with-hierarchical-custom-taxonomies/</link>
		<comments>http://www.scriptygoddess.com/archives/2010/11/19/simulate-breadcrumb-navigation-with-hierarchical-custom-taxonomies/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 01:05:08 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress scripts]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1652</guid>
		<description><![CDATA[Code is below with comments to explain what&#039;s going on. This code would go on your taxonomy.php page&#8230; &#60;?php //get current term info $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); //store curent term's id as first in the array $breadcrumbarray[] = $term-&#62;term_id; //transfer the term info object so we don't mess [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Code is below with comments to explain what&#039;s going on. This code would go on your taxonomy.php page&#8230;<br />
<code>&lt;?php<br />
 //get current term info<br />
 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );<br />
 //store curent term's id as first in the array<br />
 $breadcrumbarray[] = $term-&gt;term_id;<br />
 //transfer the term info object so we don't mess it up<br />
 $tempterm = $term;<br />
 //backward crawl terms...<br />
 //if the current term in the crawl has a parent - get it's parent's id...<br />
 while ($tempterm-&gt;parent != 0) {<br />
 $tempterm = get_term_by('id',$tempterm-&gt;parent,get_query_var( 'taxonomy' ));<br />
 // and store it in the array<br />
 $breadcrumbarray[] .= $tempterm-&gt;term_id;<br />
 }<br />
 //now reverse order the array so it goes from parent to child...<br />
 $breadcrumbarray = array_reverse($breadcrumbarray);<br />
//now we'll loop through our array to display each item in the parent to child order and with links...<br />
 $isfirst = true;<br />
 foreach($breadcrumbarray as $termid) {<br />
 if (!$isfirst) echo " » ";<br />
 $isfirst = false;<br />
 // get all the info again for the current term id in the array<br />
 $terminfo = get_term_by('id',$termid,get_query_var( 'taxonomy' ));<br />
 //show links for all terms except the current one..<br />
 if ($terminfo-&gt;term_id != $term-&gt;term_id) {<br />
 //get the URL for that terms's page<br />
 $url = get_term_link( $terminfo-&gt;name, get_query_var( 'taxonomy' ) );<br />
 echo '&lt;a href="'.$url.'"&gt;'.$terminfo-&gt;name.'&lt;/a&gt;';<br />
 } else {<br />
 echo $terminfo-&gt;name;<br />
 }<br />
 }<br />
 ?&gt;<br />
</code><br />
I couldn&#039;t see an easier (or built in) way to do this&#8230; if there is, do let me know. Seems like it&#039;s a simple thing that shouldn&#039;t require so much code&#8230;</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2010/11/19/simulate-breadcrumb-navigation-with-hierarchical-custom-taxonomies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SEO Plugins and problems with the titles not rewriting (WordPress)</title>
		<link>http://www.scriptygoddess.com/archives/2010/03/16/seo-plugins-and-problems-with-the-titles-not-rewriting-wordpress/</link>
		<comments>http://www.scriptygoddess.com/archives/2010/03/16/seo-plugins-and-problems-with-the-titles-not-rewriting-wordpress/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 17:20:22 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1633</guid>
		<description><![CDATA[I can&#039;t speak for anyone else who has run into this problem, but I know I have run into it on more than one occasion. Having just figured out my particular issue this time, I&#039;m making a note for myself (and anyone else who may have the same problem). You may run into this problem [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I can&#039;t speak for anyone else who has run into this problem, but I know I have run into it on more than one occasion. Having just figured out my particular issue this time, I&#039;m making a note for myself (and anyone else who may have the same problem).</p>
<p>You may run into this problem if you have a template that you have &#034;hardcoded&#034; the header (in my case &#8211; it was a custom page template that actually needed a completely different header than the rest of the site &#8211; so I opted not to use &#034;get_header()&#034; on this template and just put the custom header right there in my custom page template&#8230;)</p>
<p>I *did* remember to include the &#034;wp_head()&#034; &#8211; so that wasn&#039;t the issue (although I have fogotten to do that on other occasions and that will cause all kinds of trouble, including seo plugin stuff not working) &#8211; but in this case &#8211; the other meta tags were coming in &#8211; but the titles weren&#039;t being rewritten.</p>
<p>The problem was the fact that I wasn&#039;t using get_header() &#8211; this must be the function that kicks off the search for that title tag and replaces it with the rewritten titles. <strong>If you don&#039;t use get_header() &#8211; your titles will not be rewritten.</strong></p>
<p><em>You will run into the same problem even if you don&#039;t &#034;hardcode&#034; your header &#8211; and use the &#034;include&#034; line instead: </em></p>
<p><code>include( TEMPLATEPATH . '/header2.php' );</code></p>
<p>Whatever happens with &#034;get_header()&#034; &#8211; you need to run it to get those titles working.</p>
<p>(<strong>I&#039;ve since updated this post &#8211; scroll down to the bottom for the simplest solution!!</strong>)<br />
So if you have a different header for your page template &#8211; what you need to do is <strong>within your header.php</strong> &#8211; determine which header file it should load in&#8230; but ONLY AFTER you have the title tags written out&#8230; You could even use the &#034;is_page_template()&#034; function to figure out which header to pull in.</p>
<p>So my header.php looked something like this for this project I was running into with this:</p>
<p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;<br />
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br />
&lt;head&gt;<br />
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;<br />
&lt;title&gt;&lt;?php wp_title('&laquo;', true, 'right'); ?&gt; &lt;?php bloginfo('name'); ?&gt;&lt;/title&gt;<br />
&lt;?php<br />
if (is_page_template('my-custom-page-template1.php')  || is_page_template('my-custom-page-template2.php')) {<br />
include( TEMPLATEPATH . '/my-custom-page-template-header.php' );<br />
} else {<br />
?&gt;<br />
... rest of the header is here...<br />
&lt;?php } // endif custom page template checking... ?&gt;</code></p>
<p>Now you can put your custom header in that &#034;my-custom-page-template-header.php&#034; (or whatever you want to call it) and on your &#034;my-custom-page-template1.php and my-custom-page-template2.php, etc just use get_header() at the top like normal.</p>
<p><strong>Actually &#8211; here&#039;s an even better/simpler option:</strong></p>
<p>Name your custom header like this:<br />
<strong>header-<em>my-customheader</em>.php</strong>.</p>
<p>Then when you call &#034;get_header()&#034; &#8211; do so like this:</p>
<p><code>get_header('my-customheader');</code></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2010/03/16/seo-plugins-and-problems-with-the-titles-not-rewriting-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom Template for Parent and Sub Categories (without a plugin) in WordPress</title>
		<link>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/</link>
		<comments>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 06:26:11 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1632</guid>
		<description><![CDATA[When using WordPress as a CMS, I often repurpose the &#034;posts&#034; as other types of content a site may need. For example, news or press releases, or any information that might need the ability to be catgorized and/or tagged (like testimonials). However, this may mean that you need a completely different template for your news [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>When using WordPress as a CMS, I often repurpose the &#034;posts&#034; as other types of content a site may need. For example, news or press releases, or any information that might need the ability to be catgorized and/or tagged (like testimonials). However, this may mean that you need a completely different template for your news page than you would want for your testimonials page.</p>
<p>WordPress gives you the <a href="http://codex.wordpress.org/Theme_Development">ability</a> to create <a href="http://codex.wordpress.org/Category_Templates">category specific templates</a>. So let&#039;s say your &#034;news&#034; category has an ID of 5 &#8211; if you create a category.php page to be used by all the other categories, and also created a category-5.php page &#8211; then just your news page will use that template for the category archive page.</p>
<p>But &#8211; what if you have a huge handful of subcategories and you want them all to use the same category template as it&#039;s parent? (Let&#039;s also assume that we can&#039;t just make this the default template) Here&#039;s what I came up with. Let&#039;s say that Testimonials is our category &#8211; it has an id of 12. It also has a dozen or so subcategories (for argument&#039;s sake, lets say we&#039;ve sorted our testimonials into groups from what types of companies these testimoinals have come from &#034;Consulting Firms&#034;, &#034;Web Host Providers&#034;, &#034;Design Firms&#034;, etc.</p>
<p>We don&#039;t want to duplicate our category template for every subcategory we have. That&#039;s a nightmare to manage. So lets do this instead: In your category.php template file &#8211; before ANYTHING ELSE &#8211; even before you call get_header() &#8211; we add the following:</p>
<p><code>$thecategory = get_category($cat);<br />
if ($thecategory-&gt;category_parent == '12' || $thecategory-&gt;cat_ID == '12') {<br />
include(TEMPLATEPATH.'/testimonials-template.php');<br />
} else {<br />
/* include... default template file here like we included the "testimonials-template.php - or you can just wrap this around your actual template code... */<br />
}</code></p>
<p>So what this does is it gets information about the category &#8211; if the current category&#039;s PARENT is 12 OR we are in fact looking at category 12 &#8211; then we pull in that special testimonials-template.php file&#8230; Otherwise the other code would be executed. (In the file I was using I just wrapped that around my existing category.php template code&#8230;</p>
<p><strong>Please note:</strong> I have not tested this on if you have a SUB SUB category &#8211; I&#039;m thinking $thecategory-&gt;category_parent probably only looks one level above the current category&#8230; so keep that in mind.</p>
<p>(I make the note above that this does not include a plugin because when I was trying to get this to work &#8211; one solution I had found online involved installing a plugin that kind of messed with my category heirarchy in a way I wasn&#039;t crazy about. Personally, I think this is a much simpler solution)</p>
<p><strong>Updated to add: </strong><a href="http://www.designcontest.com/show/custom-template-for-parent-be">This article was translated to Belorussian here.</a></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2010/03/14/custom-template-for-parent-and-sub-categories-without-a-plugin-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Multiple Featured Content Galleries</title>
		<link>http://www.scriptygoddess.com/archives/2009/10/30/multiple-featured-content-galleries/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/10/30/multiple-featured-content-galleries/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 17:44:40 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1623</guid>
		<description><![CDATA[On a site I was working on recently, the client was using the Featured Content Galleries plugin for their homepage (you can download it from here) &#8211; but they wanted to add a gallery like this to other pages on their website and have other featured content on those pages. This is not a feature [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>On a site I was working on recently, the client was using the <a href="http://www.featuredcontentgallery.com/">Featured Content Galleries</a> plugin for their homepage (<a href="http://wordpress.org/extend/plugins/featured-content-gallery/">you can download it from here</a>) &#8211; but they wanted to add a gallery like this to other pages on their website and have other featured content on those pages. This is not a feature currently supported &#034;out of the box&#034; with this plugin. But hacking it in is pretty easy.</p>
<p>First &#8211; you will need to create a category that you will use for the other Featured Content Galleries &#8211; one per page you want to use it with. Assign posts you want to appear in the featured content gallery with this new category. For example &#8211; lets say on your homepage you&#039;re running the featured content gallery, and it&#039;s showing posts from the &#034;featured-posts&#034; category. But lets say you have a &#034;products&#034; page and on that page, you only want articles related to your products showing up on that page. So you would need to create another category &#8211; lets call it &#034;featured-posts-about-products&#034;. Then assign this new category to your articles about products. (**Make a note of what the category ID is of this new category!)</p>
<p>You will still need to make sure those posts have a custom field with a key of &#034;articleimg&#034; and a value that is the full URL to the image you want in the featured content gallery.</p>
<p>Now we can start hacking at the plugin&#8230;</p>
<p>Open up <strong>gallery.php</strong> (found in the <strong>featured-content-gallery</strong> plugin directory). MAKE A BACKUP OF GALLERY.PHP JUST IN CASE! <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Then, look for this line:</p>
<pre class="brush: php; title: ; notranslate">query_posts('category_name=' . get_option('gallery-category') . '&amp;showposts=' . get_option('gallery-items'));</pre>
<p>and replace with the following:</p>
<pre class="brush: php; title: ; notranslate">$categoryToUse = 'category_name=' . get_option('gallery-category');
if (isset($catidforgallery) &amp;&amp; is_numeric($catidforgallery)) {
$categoryToUse = 'cat=' . $catidforgallery;
}
query_posts($categoryToUse . '&amp;showposts=' . get_option('gallery-items'));</pre>
<p>NOW in your theme &#8211; where you have the featured content gallery appearing &#8211; if you want it to pull from that special category, you can do this:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$catidforgallery = 1234;
include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php');
?&gt;</pre>
<p>The above code assumes our category ID is &#034;1234&#034;.</p>
<p>But lets say you&#039;re using this template for a number of different pages, and on each one you want a different content gallery&#8230; Again, set up these new categories, make notes of what their IDs are &#8211; then on each page that&#039;s using this template, to specify what category ID the featured content gallery should use, add a custom field with a key of &#034;category-feature-rotator&#034; and a value of the category ID you want in the gallery.</p>
<p>Modify the theme/template code to this instead:</p>
<pre class="brush: php; title: ; notranslate">&lt;?php
$category_feature_rotator = get_post_meta($post-&gt;ID, &quot;category-feature-rotator&quot;, true);
$catidforgallery = false;
if (isset($category_feature_rotator) &amp;&amp; $category_feature_rotator != 0) {
$catidforgallery = $category_feature_rotator;
}
include (ABSPATH . '/wp-content/plugins/featured-content-gallery/gallery.php');
?&gt;</pre>
<p>That will look for the custom field and use the category ID you put in for that custom field &#8211; and if it&#039;s not there &#8211; then it will just default to the category specified on the Featured Content Gallery options page.</p>
<p>IMPORTANT NOTE: If/when there is an update to the Feature Content Gallery plugin &#8211; upgrading will overwrite these changes. This post was written for version 3.2.0 of the plugin. Hopefully they&#039;ll build this feature in a next release of the plugin. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><strong>UPDATE 11/16/09</strong> <a href="http://ArtisanPhotography.com/">Greg</a> had asked in the comments about being able to do a similar technique with multiple featured content galleries, but being able to specify page IDs. He was able to solve the problem before I could and sent me the solution. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>To use Page IDs in the gallery:</strong> On the page you want to have the gallery displayed on, create a custom field with a key of &#034;pageids&#034; &#8211; and for the value, give a comma seperated list of page ids.</p>
<p>Where I had been pulling the &#034;category-feature-rotator&#034; custom field &#8211; replace that with the following:</p>
<pre class="brush: php; title: ; notranslate">$pageids = get_post_meta($post-&gt;ID, &quot;pageids&quot;, true);</pre>
<p>Then look for the following line in gallery.php (should be around 24)</p>
<pre class="brush: php; title: ; notranslate">$arr = split(&quot;,&quot;,get_option('gallery-items-pages'));</pre>
<p>and change it to this:</p>
<pre class="brush: php; title: ; notranslate">$arr = split(&quot;,&quot;,($pageids));</pre>
<p><em>*Note: I haven&#039;t personally tested the Page ID method &#8211; so if you try it &#8211; please report back how it goes&#8230;</em></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/10/30/multiple-featured-content-galleries/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Striping IMG tags from the_content in WordPress (and how to fudge page excerpts)</title>
		<link>http://www.scriptygoddess.com/archives/2009/10/27/striping-img-tags-from-the_content-in-wordpress-and-how-to-fudge-page-excerpts/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/10/27/striping-img-tags-from-the_content-in-wordpress-and-how-to-fudge-page-excerpts/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 18:10:21 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress: Lessons Learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1622</guid>
		<description><![CDATA[Background: For a site I was working on, I was pulling in content from another page onto the homepage. However I wanted to just bring in an excerpt not the whole page. (And actually, a customized excerpt at that &#8211; not a default set character or word limit). I also didn&#039;t want any images brought [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>Background: For a site I was working on, I was pulling in content from another page onto the homepage. However I wanted to just bring in an excerpt not the whole page. (And actually, a customized excerpt at that &#8211; not a default set character or word limit). I also didn&#039;t want any images brought in &#8211; I just wanted the text and any associated formatting.</p>
<p>Well, one problem here is that WordPress pages (at least as of this writing &#8211; with WordPress in version 2.8.5) do not have excerpts for pages. Only for posts. The way around this is to use the &lt;!&#45;&#45; more &#45;&#45;&gt; tag where you want your break. So that works fine &#8211; but what about stripping out the images? I&#039;m still working on my reg-ex knowledge, but I found this one from <a href="http://www.webmasterworld.com/forum88/6851.htm">here</a> and it worked for me. So this is what I&#039;m doing when I&#039;m pulling in my page excerpt:</p>
<p><code>&lt;?php<br />
$posts = query_posts('page_id=1234');<br />
if (have_posts()) : while (have_posts()) : the_post();<br />
//this makes the more work...<br />
global $more; $more = 0;<br />
?&gt;<br />
&lt;h1&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;<br />
&lt;?php<br />
$content = get_the_content('');<br />
$content = preg_replace('/&lt;img[^&gt;]+&gt;/is', '', $content);<br />
echo $content;<br />
?&gt;<br />
&lt;p&gt;&lt;a href="&lt;?php the_permalink(1234); ?&gt;"&gt;&lt;img src="/images/more.gif" /&gt;&lt;/a&gt;&lt;/p&gt;<br />
&lt;?php endwhile; endif; ?&gt;</code></p>
<p>*we&#039;re assuming &#034;1234&#034; is the ID of my page in the example above&#8230;</p>
<p>You&#039;ll also notice I manually added my &#034;more&#034; button image&#8230;</p>
<p>To read more about the more tag (and see where I got that global $more; $more = 0; from, you can see the <a href="http://codex.wordpress.org/Customizing_the_Read_More">WordPress codex here on the subject</a>. (Scroll to the very bottom of the page &#8211; to the section title &#034;How to use Read More in Pages&#034;)</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/10/27/striping-img-tags-from-the_content-in-wordpress-and-how-to-fudge-page-excerpts/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Conditionally change path to HTTPS</title>
		<link>http://www.scriptygoddess.com/archives/2009/10/06/conditionally-change-path-to-https/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/10/06/conditionally-change-path-to-https/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 22:01:25 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1618</guid>
		<description><![CDATA[One of my clients had set it up so that one particular page in their WordPress install would load as https:// and even though they changed all links they could find in their template to use root-relative links, they were still getting complaints from IE about the page loading some secure and non-secure items. A [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>One of my clients had set it up so that one particular page in their WordPress install would load as https:// and even though they changed all links they could find in their template to use <a href="http://www.motive.co.nz/glossary/linking.php">root-relative link</a>s, they were still getting complaints from IE about the page loading some secure and non-secure items. A look through the source code revealed that two plugins in particular (an <a href="http://wordpress.org/extend/plugins/events-manager/">event manager plugin</a> and <a href="http://www.deliciousdays.com/cforms-plugin">cforms plugin</a>) pulled in their CSS or javascript files without the https. It probably got these settings from the main WordPress install, which wasn&#039;t set to use ALL https &#8211; the had just set it up so that this one page would be (using a special template for https pages). But there was no way to get that information to the plugin&#8230; So I needed to do a little hacking to the plugin(s) and add in a conditional statement that would check if the page being viewed was https &#8211; and if so, swap out http:// for https:// in the path to the file. </p>
<p>In the case of the cforms plugin, the file I had to modify was cforms.php &#8211; the line I found that pulled in the file path looks like this:</p>
<pre name="code" class="php">$cforms_root = $cformsSettings['global']['cforms_root'];</pre>
<p>So, just below that I added this:</p>
<pre name="code" class="php">if(isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "on") {
$cforms_root = str_replace("http://","https://",$cforms_root);
}</pre>
<p>Pretty simple. Of course, if/when we need to upgrade the plugin, the change will be overwritten &#8211; but it&#039;s pretty easy to add back in&#8230;</p>
<p><a href="http://www.deliciousdays.com/cforms-forum/troubleshooting/https-problems/">(Apparently, I&#039;m not the only one with this issue&#8230;)</a></p>
<p>In the case of the event manager plugin, the file I modified was dbem_events.php:</p>
<p>So just below this:</p>
<pre name="code" class="php">function dbem_general_css() {
$base_url = get_bloginfo('url');</pre>
<p>I added this:</p>
<pre name="code" class="php">if(isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "on") {
$base_url = str_replace("http://","https://",$base_url);
}</pre>
<p>No more complaints from IE.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/10/06/conditionally-change-path-to-https/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a block of HTML to a WordPress post</title>
		<link>http://www.scriptygoddess.com/archives/2009/09/27/adding-a-block-of-html-to-a-wordpress-post/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/09/27/adding-a-block-of-html-to-a-wordpress-post/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 03:10:10 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress: Lessons Learned]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1617</guid>
		<description><![CDATA[One problem with the WYSIWYG editor in WordPress is that if you are trying to manually add in a block of HTML, the editor may try to translate that block into paragraph format, inserting &#60;p&#62; tags where you didn&#039;t intend, possibly (and most likely) ruining what you were intending to do with your HTML code [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>One problem with the WYSIWYG editor in WordPress is that if you are trying to manually add in a block of HTML, the editor may try to translate that block into paragraph format, inserting &lt;p&gt; tags where you didn&#039;t intend, possibly (and most likely) ruining what you were intending to do with your HTML code block.</p>
<p>Previously, my way around this had included the use of various plugins that had you wrap certain areas in your post with specific comments that would tell WordPress to leave that block alone and not insert those paragraph tags. There was still some issues doing it this way &#8211; as it required you to view these posts in the HTML view. Viewing them in the visual editor would mess everything up.</p>
<p>So, keeping in line with what seems to be a current trend at the moment of solving all my problems with shortcodes, that&#039;s how I&#039;ve decided to solve this problem as of late.</p>
<p>First &#8211; (you&#039;ll only need to do this once) &#8211; add the PHP code so that you can do the shortcode. If you don&#039;t already have a functions.php file in your theme directory, create one and add the following code:</p>
<p><code>function scriptysAddHTML_func($atts) {<br />
global $post;<br />
$id = $atts['id'];<br />
if (empty($id)) return;<br />
return get_post_meta($post->ID, $id, true);<br />
}<br />
add_shortcode('html', 'scriptysAddHTML_func');</code></p>
<p>Then, in your post when you want to add some custom HTML, paste your block of HTML into the <strong>value</strong> of a new custom field. For the <strong>name</strong> of this custom field, give it a unique name with no spaces. (For example: My_HTML_Block)</p>
<p>In your WordPress post, where you want this block to appear, add the shortcode like this:</p>
<p><code>&#91;html id=My_HTML_Block]</code></p>
<p>You would add it exactly like the above, except instead of My_HTML_Block, you would change that to be the name you gave your custom field.</p>
<p><strong>Extra Tip</strong> If for some reason, you&#039;re using more than one shortcode in your post and it doesn&#039;t seem like they&#039;re working&#8230; if you&#039;re using them one right after the other, make sure there is a space between them. ie. If you&#039;re using my <a href="http://www.scriptygoddess.com/archives/2009/08/29/simple-shortcode-for-line-breaks/">linebreak shortcode</a>, and you were adding more than one linebreak&#8230; it might not work if you do this:</p>
<p><code>[br][br][br]</code></p>
<p>You my have to do this:</p>
<p><code>[br] [br] [br]</code></p>
<p>Little minor thing, but something you might not have thought of&#8230; figured I&#039;d mention it. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/09/27/adding-a-block-of-html-to-a-wordpress-post/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Anchor Links in WordPress Posts &#8211; another shortcode solution</title>
		<link>http://www.scriptygoddess.com/archives/2009/09/10/anchor-links-in-wordpress-posts-another-shortcode-solution/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/09/10/anchor-links-in-wordpress-posts-another-shortcode-solution/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 18:10:27 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1614</guid>
		<description><![CDATA[I was recently asked by a client how they could easily add anchor links within a particularly long post they had made in WordPress. (Ie. a list of links at the top of the page that would jump the user down to the appropriate section where they needed to be.) I thought about maybe explaining [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I was recently asked by a client how they could easily add anchor links within a particularly long post they had made in WordPress. (Ie. a list of links at the top of the page that would jump the user down to the appropriate section where they needed to be.) I thought about maybe explaining to them to switch over the HTML tab and writing the HTML for the anchor links, but that step alone can sometimes really freak some clients out. <img src='http://www.scriptygoddess.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  So I came up with a solution to the problem using shortcodes and using the &#034;build link&#034; button already in the WordPress edit post box.</p>
<p>So the first step is to create the code so the shortcode will work. If you don&#039;t already have a functions.php file in your template directory, make a new file, name it &#034;functions.php&#034; and add the following code (surrounded by &lt;?php and ?&gt;). If you do already have a functions.php file, add the following code within those php tags:</p>
<p><code>function anchorlink($atts) {<br />
	extract(shortcode_atts(array(<br />
			"id" =&gt; ''<br />
			), $atts));<br />
	return '&lt;a name="'.$id.'"&gt;&lt;/a&gt;';<br />
}<br />
add_shortcode('anchor', 'anchorlink');</code></p>
<p>Then, in your post. In front of the location you want to be able to create a link to add the following:</p>
<p><code>[anchor id="unique_id_here"]</code></p>
<p>So for example.. If your post is a &#034;Q/A&#034; type page, down where you have the full question and answer, add that shortcode:</p>
<p><code><strong>[anchor id="elephantquestion"]</strong>Q: What do elephants eat?<br />
A: Elephants eat mainly grass, leaves, bark and twigs. Sometimes they will also eat fruit and seeds.</code></p>
<p>Then at the top &#8211; where you probably have a list of all the questions on the page like this:</p>
<p><code>What do elephants eat?<br />
What do giraffes eat?<br />
etc.</code></p>
<p>(In this example) highlight the &#034;What do elephants eat&#034; text, click the LINK button in the edit post area &#8211; remove the &#034;http://&#034; that automatically is included in the link field that pops up and instead, add a pound symbol <strong>#</strong> and then the id you used:<br />
<img src="http://www.scriptygoddess.com/wp-content/uploads/2009/09/Screen-shot-2009-09-10-at-Sep-10-11.51.47-AM.png" alt="Screen shot 2009-09-10 at Sep 10  11.51.47 AM" title="Screen shot 2009-09-10 at Sep 10  11.51.47 AM" width="325" height="233" class="alignnone size-full wp-image-1615" /></p>
<p>I know this isn&#039;t a huge leap from simply writing the HTML that does this. But I&#039;ve found that some clients don&#039;t understand (and don&#039;t want to understand) HTML. This IS actually simpler for them. Especially when you might run into the scenario of someone forgetting to close the anchor tag with a &lt;/a&gt; &#8211; and suddenly the whole page is acting weird&#8230; I also think it&#039;s probably helpful to SEE the ID right there in plain text in the post &#8211; so that when you&#039;re making the links at the top, you can quickly see what the ID is that you need to link to.</p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/09/10/anchor-links-in-wordpress-posts-another-shortcode-solution/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Simple Shortcode for Line Breaks</title>
		<link>http://www.scriptygoddess.com/archives/2009/08/29/simple-shortcode-for-line-breaks/</link>
		<comments>http://www.scriptygoddess.com/archives/2009/08/29/simple-shortcode-for-line-breaks/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 03:41:48 +0000</pubDate>
		<dc:creator>Jennifer</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>

		<guid isPermaLink="false">http://www.scriptygoddess.com/?p=1613</guid>
		<description><![CDATA[One kind of funny thing with WordPress is that entering HTML in the post window can sometimes lead to unexpected results. Sometimes WordPress (or probably more specifically the WYSIWYG visual editor) will eat some or all of the HTML. A friend of mine (Hi Chris!) was asking me how to add line breaks to her [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>One kind of funny thing with WordPress is that entering HTML in the post window can sometimes lead to unexpected results. Sometimes WordPress (or probably more specifically the WYSIWYG visual editor) will eat some or all of the HTML. A friend of mine (Hi Chris!) was asking me how to add line breaks to her post. Adding the actual HTML for a line break didn&#039;t work because WordPress ate it. The simplest solution for this is to use shortcodes to get the HTML into the post without WordPress munching it.</p>
<p>To add the shortcode &#8211; go to your themes functions.php file (if you don&#039;t have this file in your theme, simply create a file called &#034;functions.php&#034; and throw it in your theme folder.) Then add the following code to this file (make sure the function name doesn&#039;t class with something else already in there just in case!)</p>
<p><code>function breakall() {<br />
    return '&lt;br clear="all" /&gt;';<br />
}<br />
add_shortcode('br', 'breakall');</code></p>
<p>Now, when writing your posts, if you need to add a line break or two just add the following where you want the linebreak:</p>
<p><code><strong>[br]</strong></code></p>
<p>That will be converted to <strong>&lt;br clear=&#034;all&#034; /&gt;</strong> when the page is displayed.</p>
<p>Shortcodes are an amazingly powerful little feature. Read more about shortcodes here:</p>
<p><a href="http://codex.wordpress.org/Shortcode_API">Shortcode API</a><br />
<a href="http://www.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/">Mastering WordPress Shortcodes</a><br />
<a href="http://www.catswhocode.com/blog/10-incredibly-cool-wordpress-shortcodes">10 Incredibly Cool WordPress Shortcodes</a></p>
<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.scriptygoddess.com/archives/2009/08/29/simple-shortcode-for-line-breaks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

