<?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>wordpress-tips &#8211; Extreme Web Designs</title>
	<atom:link href="https://theextremewebdesigns.com/blog/tag/wordpress-tips/feed/" rel="self" type="application/rss+xml" />
	<link>https://theextremewebdesigns.com/blog</link>
	<description>Web Design and Web Development</description>
	<lastBuildDate>Wed, 04 Sep 2013 19:05:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>
<site xmlns="com-wordpress:feed-additions:1">156673191</site>	<item>
		<title>Disable Comments For A Single Post Or Page in WordPress</title>
		<link>https://theextremewebdesigns.com/blog/disable-comments-single-post-page-wordpress/</link>
					<comments>https://theextremewebdesigns.com/blog/disable-comments-single-post-page-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 04 Sep 2013 19:05:16 +0000</pubDate>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=3953</guid>

					<description><![CDATA[If you use WordPress as a blog or as a website, then you may have come across a situation where you needed to disable comments for a specific post or for a specific page. But do you see an option to do so in the Edit Post/Page screen? No! Then how would you disable the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you use WordPress as a blog or as a website, then you may have come across a situation where you needed to disable comments for a specific post or for a specific page. But do you see an option to do so in the Edit Post/Page screen? No! Then how would you disable the comments specifically for only the post(s) and page(s) you desire? Well, in this article, I am going to show you how to do this in 3 simple and easy steps. Follow along for more info.</p>
<h2>How to disable comments on certain Posts and Pages?</h2>
<p>It&#8217;s very easy to do so. And I will show you how to do this for both posts and pages. Let&#8217;s assume that you are logged into your WordPress website as Admin and let&#8217;s get started.</p>
<h3>Disabling comments for a specific Post:</h3>
<p>1. Click on &#8220;All Posts&#8221; link under the &#8220;Posts&#8221; menu in Left Hand navigation.<br />
2. Scroll to the Post that you wish to disable the comments upon and hover over the title. You will see the following options: <strong>Edit | Quick Edit | Trash | View</strong>. Click on &#8220;<strong>Quick Edit</strong>&#8220;.<br />
3. Now you will see the Quick Edit box with basically three columns in it. Notice that in the third column, under the &#8220;Tags&#8221; textarea, there is a checkbox that says &#8220;Allow Comments&#8221;. This is selected by default. Simply uncheck it and click on the &#8220;Update&#8221; button.<br />
That&#8217;s it! You are done!</p>
<h3>Disabling comments for a specific Page:</h3>
<p>1. Click on &#8220;All Pages&#8221; link under the Pages&#8221; menu in Left Hand navigation.<br />
2. Scroll to the Page that you wish to disable the comments upon and hover over the title. You will see the same options as you see when you hover over a Post title i.e. <strong>Edit | Quick Edit | Trash | View</strong>. Click on &#8220;<strong>Quick Edit</strong>&#8220;.<br />
3. Now you will see the Quick Edit box with basically two columns in it. Notice that in the second column, under the &#8220;Template&#8221; dropdown, there is a checkbox that says &#8220;Allow Comments&#8221;. This is selected by default. Simply uncheck it and click on the &#8220;Update&#8221; button.</p>
<p>That&#8217;s all you need to achieve your objective!</p>
<h5>Your Turn!</h5>
<p>Do you think this post has been useful to you? Feel free to share your thoughts by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/disable-comments-single-post-page-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3953</post-id>	</item>
		<item>
		<title>SOLUTION WordPress Fatal error: Call to undefined function</title>
		<link>https://theextremewebdesigns.com/blog/solution-wordpress-fatal-error-call-to-undefined-function/</link>
					<comments>https://theextremewebdesigns.com/blog/solution-wordpress-fatal-error-call-to-undefined-function/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 12 Jun 2013 19:05:48 +0000</pubDate>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=3888</guid>

					<description><![CDATA[While working with WordPress, at one point of time or the other, you may have come across error message that says: &#8220;Fatal error: Call to undefined function &#8230; &#8220;. In this message, the undefined function could be just about anything such as feed_content_type or get_adjacent_post or wp_get_recent_posts, etc. So how can we solve this? This is exactly what this [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>While working with WordPress, at one point of time or the other, you may have come across error message that says: <strong>&#8220;Fatal error: Call to undefined function &#8230; &#8220;. </strong>In this message, the undefined function could be just about anything such as feed_content_type or get_adjacent_post or wp_get_recent_posts, etc. So how can we solve this? This is exactly what this article is all about. I am going to share a very easy way that you can use in your theme or plugin to gracefully solve and prevent fatal errors from showing up and breaking the normal functionality of your WordPress theme or plugin.</p>
<p><span id="more-3888"></span></p>
<h2>How To Solve Fatal error: Call to undefined function &#8230; in WordPress Themes &amp; Plugins</h2>
<p>Now let&#8217;s say that you are working on a WordPress theme. You would like to use the function &#8220;<strong>the_excerpt</strong>&#8220;. Now you do not know whether this function has already been declared or not. So to be on the safer side do the following:</p>
<h3>Use the following code in your theme to prevent fatal errors:</h3>
<pre class="lang:xhtml decode:true">&lt;?php 
if (function_exists('the_excerpt')) 
{ 
	the_excerpt(); 
} 
?&gt;</pre>
<p>The above code will first check to see if the function really exists. If the function is already defined and available for use, the excerpt will be fetched and shown on the screen. If not, it will simply not do anything at all. You can also combine the above code with other conditional code to display another result if the function does not exist. Consider the following example:</p>
<pre class="lang:xhtml decode:true">&lt;?php
if (function_exists('the_excerpt')) 
{ 
     the_excerpt(); 
} 
else 
{ 
     echo 'The function is Undefined';
} ?&gt;</pre>
<p>You can do the same thing as above in your plugins as well.</p>
<h3>How to apply the above code to any custom functions in your custom Plugin and prevent fatal errors</h3>
<p>Let&#8217;s say you are coding custom plugin. And now you have defined some function such as &#8220;my_function1&#8221;,  &#8220;my_function2&#8221;. Now you want to use these in your plugin and want to avoid showing fatal errors. Simply apply the function_exists function prior to using it and that will solve it. Here are couple of examples:</p>
<h3>Example 1:</h3>
<pre class="lang:xhtml decode:true">&lt;?php 
if (function_exists('my_function1')) 
{ 
	my_function1(); 
} 
?&gt;</pre>
<h3> Example 2:</h3>
<pre class="lang:xhtml decode:true">&lt;?php 
if (function_exists('my_function2')) 
{ 
	my_function2(); 
} 
?&gt;</pre>
<h3> Example 3:</h3>
<pre class="lang:xhtml decode:true">&lt;?php 
if (function_exists('this_is_my_custom_function')) 
{ 
	echo this_is_my_custom_function(); 
} 
?&gt;</pre>
<p>As you can see from the above codes, it is really simple. Simply check if the function exists using the function_exists function and that should do it.</p>
<h5>Simple, isn&#8217;t it?</h5>
<p>Do you know of any other ways to solve the <em><strong>Fatal error Call to undefined function problem in WordPress</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/solution-wordpress-fatal-error-call-to-undefined-function/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3888</post-id>	</item>
		<item>
		<title>WordPress: Get Count For Approved Comments Outside The Loop</title>
		<link>https://theextremewebdesigns.com/blog/getting-comments-count-in-wordpress/</link>
					<comments>https://theextremewebdesigns.com/blog/getting-comments-count-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 03 May 2013 19:54:00 +0000</pubDate>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-snippets]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=3779</guid>

					<description><![CDATA[If you are a Web Developer and you work with WordPress, then there may have been a situation where you needed to get the count for  comments that were only in &#8220;Approved&#8221; state for a specific post. Note that this is different from the total comments count. So do you know how to get the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you are a Web Developer and you work with WordPress, then there may have been a situation where you needed to get the count for  comments that were only in &#8220;Approved&#8221; state for a specific post. Note that this is different from the total comments count. So do you know how to <em><strong>get the comments count for Approved comments in WordPress</strong></em>? If not, then this article is for you. In this article, I am going to share a very easy way to get the count for all comments that are either Approved, Moderated, or in Spam and in Trash.</p>
<p><span id="more-3779"></span></p>
<h2>How to get comments count in WordPress for different comment states (Approved, Moderated, Spam, Trash ) outside WordPress loop</h2>
<p>In order to get the comments count outside of the loop, we use the following function:</p>
<pre class="lang:xhtml decode:true">&lt;?php wp_count_comments( $post_id ); ?&gt;

post_id (optional) - The ID of the post for which you want to get the comments count and it is optional inside the loop</pre>
<p>In the above function, note that when you use it, you won&#8217;t directly get the comment count directly as wp_count_comments returns us an object. So rather you would have to point to the properties inside of the object to get it&#8217;s corresponding value. So let&#8217;s say we want to get the comments count for post with ID 10. I am going to list all possibilities below:</p>
<pre class="lang:php decode:true">&lt;?php //10 is the post ID. Mention it explicitly outside the loop. Inside the loop, you would want to use get_the_ID()

$comments_count = wp_count_comments( 10 );

?&gt;</pre>
<h3> Get Approved Comments count:</h3>
<pre class="lang:xhtml decode:true">&lt;?php echo "Comments approved: " . $comments_count-&gt;approved ; ?&gt;</pre>
<h3> Get Count of Comments that are in Moderation:</h3>
<pre class="lang:xhtml decode:true">&lt;?php echo "Comments in moderation: " . $comments_count-&gt;moderated ; ?&gt;</pre>
<h3> Get Count of Comments that are in Spam:</h3>
<pre class="lang:xhtml decode:true">&lt;?php echo "Comments in Spam: " . $comments_count-&gt;spam ; ?&gt;</pre>
<h3> Get Count of Comments that are in Trash:</h3>
<pre class="lang:xhtml decode:true">&lt;?php echo "Comments in Trash: " . $comments_count-&gt;trash ; ?&gt;</pre>
<h3> Get the total count of comments, regardless of their state:</h3>
<pre class="lang:xhtml decode:true">&lt;?php echo "Total Comments: " . $comments_count-&gt;total_comments ; ?&gt;</pre>
<h5>That&#8217;s it!</h5>
<p>Do you know of any other ways to <em><strong>get comments count in WordPress</strong></em>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/getting-comments-count-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3779</post-id>	</item>
		<item>
		<title>WordPress Display Thumbnail for Post (2 Ways)</title>
		<link>https://theextremewebdesigns.com/blog/wordpress-display-thumbnail-for-post-2-ways/</link>
					<comments>https://theextremewebdesigns.com/blog/wordpress-display-thumbnail-for-post-2-ways/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 22 Jan 2013 01:48:15 +0000</pubDate>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-snippets]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=98</guid>

					<description><![CDATA[Did you ever want to make WordPress display Thumbnail for post but did not know how to do it? I am going to discuss 2 ways to do this. Just copy this snippet into your theme, wherever you want to display the thumbnail and that should do it. Method 1: if (has_post_thumbnail()) { $thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail_name'); // [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Did you ever want to make <em><strong>WordPress display Thumbnail for post </strong></em>but did not know how to do it? I am going to discuss 2 ways to do this. Just copy this snippet into your theme, wherever you want to <strong>display the thumbnail</strong> and that should do it.<span id="more-98"></span></p>
<p><strong>Method 1:</strong></p>
<pre class="lang:php decode:true">if (has_post_thumbnail())
{
$thumb = wp_get_attachment_image_src(get_post_thumbnail_id(), 'thumbnail_name');
// This gives the thumbnail url
echo $thumb[0];
}</pre>
<p><strong>Method 2:</strong></p>
<pre class="lang:php decode:true">&lt;?php
if(has_post_thumbnail())
{
the_post_thumbnail();
}
?&gt;</pre>
<p>Do you know of any better method or a new method to <strong>display thumbnail for a post in WordPress</strong>? If yes, please share it with us in your comment below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/wordpress-display-thumbnail-for-post-2-ways/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">98</post-id>	</item>
		<item>
		<title>WordPress: Get all Categories of a post (both parent and children/sub categories)</title>
		<link>https://theextremewebdesigns.com/blog/wordpress-get-all-categories-of-a-post/</link>
					<comments>https://theextremewebdesigns.com/blog/wordpress-get-all-categories-of-a-post/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 19 Jan 2013 13:47:16 +0000</pubDate>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[tips-tricks]]></category>
		<category><![CDATA[wordpress-snippets]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=112</guid>

					<description><![CDATA[Have you ever wondered how to retrieve or get all categories of a post?  This little snippet will help you make WordPress get all Categories of a post (both parent and children/sub categories). WordPress: Get all Categories of a post (both parent and children/sub categories) &#60;?php the_category(', '); ?&#62; Do you know of any other way to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Have you ever wondered how to retrieve or get all categories of a post?  This little snippet will help you make WordPress get all Categories of a post (both parent and children/sub categories).<span id="more-112"></span></p>
<h2>WordPress: Get all Categories of a post (both parent and children/sub categories)</h2>
<pre class="lang:php decode:true">&lt;?php the_category(', '); ?&gt;</pre>
<p>Do you know of any other way to  <strong>fetch both parent and children/sub categories of a post</strong>? If yes, please share it with us in your comment below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/wordpress-get-all-categories-of-a-post/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">112</post-id>	</item>
		<item>
		<title>WordPress: How to use Shortcode in Widget</title>
		<link>https://theextremewebdesigns.com/blog/wordpress-how-to-use-shortcode-in-widget/</link>
					<comments>https://theextremewebdesigns.com/blog/wordpress-how-to-use-shortcode-in-widget/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 16 Dec 2012 20:44:26 +0000</pubDate>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1935</guid>

					<description><![CDATA[Have you ever wondered how to use Shortcode in Widget for WordPress? If you have noticed in general, even if you use Shortcode in a Widget area &#38; would expect the proper output to be shown, that won&#8217;t be the case. So how to go about telling WordPress to parse shortcodes &#38; execute the relevant [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Have you ever wondered how to <strong>use Shortcode in Widget for WordPress</strong>? If you have noticed in general, even if you use Shortcode in a Widget area &amp; would expect the proper output to be shown, that won&#8217;t be the case. So how to go about telling WordPress to parse shortcodes &amp; execute the relevant function? Well, this is what this article is all about. In this article, I am going to share a very easy way to <strong>use Shortcode in Widget</strong> directly. Actual code is just 1 line, so it&#8217;s super easy to follow.<span id="more-1935"></span></p>
<h2>How to use Shortcode in Widget for WordPess</h2>
<p>Before we move on to see how to use Shortcode in Widget for WordPress, let&#8217;s take a very quick look at what the terms &#8220;Shortcode&#8221; &amp; &#8220;Widget&#8221; stands for, as far as WordPress is concerned.</p>
<h3>Shortcode:</h3>
<p>It is simply a line of code that when used in conjunction with WordPress theme, widget, plugin, etc. executes the associated function, performs the related operations as written in the code &amp; shows the output result. That’s it for the definition.</p>
<h3>Widget:</h3>
<p>Simply put, WordPress Widgets enrich user experience by letting you add content and features to your WordPress theme sidebar(s). Some of the examples include, but not limited to default WordPress widgets such as the Blogroll, Search Box, Navigation etc. Some plugins often include their own custom widgets that can be added/removed from theme sidebar using WordPress Admin panel.</p>
<h2>Ok, so how to use Shortcode in Widget?</h2>
<p>It&#8217;s very simple. In order to <strong>use Shortcodes in sidebar widgets</strong> to be parsed as they are mean to be, simply edit the functions.php file of your theme and add the following code in it:</p>
<pre class="lang:php decode:true">&lt;?php add_filter('widget_text', 'do_shortcode'); ?&gt;</pre>
<p>Once you have entered the above code, save the file &amp; reupload back to the theme folder. So by using the Appearance &gt; Widgets menu option via Admin panel, you can now add the corresponding widget (such as the Arbitrary HTML widget)  and enter the shortcodes you desire &amp; save it. Once done, if the shortcode has the corresponding function properly, it should now execute the shortcode &amp; show the relevant output.</p>
<p><strong>That&#8217;s it!</strong></p>
<p>Do you know of any other ways to<strong> use Shortcode in Widget for WordPress</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/wordpress-how-to-use-shortcode-in-widget/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1935</post-id>	</item>
		<item>
		<title>WordPress Shortcodes: How to use Shortcodes in WordPress Theme Examples</title>
		<link>https://theextremewebdesigns.com/blog/wordpress-shortcodes-how-to-use-shortcodes-in-wordpress-theme-examples/</link>
					<comments>https://theextremewebdesigns.com/blog/wordpress-shortcodes-how-to-use-shortcodes-in-wordpress-theme-examples/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 16 Dec 2012 09:18:28 +0000</pubDate>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1914</guid>

					<description><![CDATA[Using Shortcodes in WordPress themes: If you are wondering how to use Shortcodes in WordPress Themes, then this article is for you. In this article, I am going to show you how easily you can use shortcodes in any of the existing WordPress themes or a brand new WordPress theme. Read on to find out [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Using Shortcodes in WordPress themes:</strong> If you are wondering how to use Shortcodes in WordPress Themes, then this article is for you. In this article, I am going to show you how easily you can use shortcodes in any of the existing WordPress themes or a brand new WordPress theme. Read on to find out more.<span id="more-1914"></span></p>
<h2>How to use Shortcodes in WordPress Theme</h2>
<p>Before we move on, let&#8217;s quickly try to understand what a Shortcode is.</p>
<h3>Shortcode:</h3>
<p>It is simply a line of code that when used in conjunction with WordPress theme, widget, plugin, etc. executes the associated function, performs the related operations as written in the code &amp; shows the output result. That&#8217;s it for the definition.</p>
<h3>So how to actually make use of Shortcodes in WordPress Theme?</h3>
<p>There are couple of ways to do this. Following are the examples:</p>
<p><strong>Example 1:</strong></p>
<p>Assuming the want to use a shortcode named [my_shortcode] in a WordPress theme, simply copy &amp; paste the following line of code in your theme where you want the output result of the shortcode to appear:</p>
<pre class="lang:php decode:true">&lt;?php echo do_shortcode("[my_shortcode]"); ?&gt;</pre>
<p>By mentioning the do_shortcode() command explicity, you thereby indicate to WordPress that you are trying to use a shortcode &amp; thus make it honor your request. In order for this to work, you must have the relevant function by the name my_shortcode in your functions.php file (if you are using only a theme) or in the necessary php file (in case you are using the shortcode in a  plugin).</p>
<p><strong>Example 2:</strong></p>
<p>Here&#8217;s an extended example. Let&#8217;s say that you are building a photo gallery &amp; want the shortcode to show the photo gallery in the WordPress theme, so you can follow the code below:</p>
<pre class="lang:xhtml decode:true">[mygallery id="12345" size="large"]</pre>
<p><strong>Associated function for mygallery shortcode (goes in the functions.php file)</strong></p>
<pre class="lang:php decode:true">function mygallery_function( $atts )
{
	$gallery_images = '&lt;img src="flower.jpg" width="300" height="300" /&gt;&lt;br /&gt;';
	$gallery_images .= '&lt;img src="apple.jpg" width="300" height="300" /&gt;&lt;br /&gt;';
	$gallery_images .= '&lt;img src="liberty.jpg" width="300" height="300" /&gt;';        

	return $gallery_images;
}

add_shortcode( 'mygallery ', 'mygallery_function' );</pre>
<p>The above example is very simple &amp; minimal. The usage can be extended &amp; customized to our needs.</p>
<h5>Simple, isn&#8217;t it?</h5>
<p>Do you know of any other ways to <strong>use Shortcodes in WordPress themes</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/wordpress-shortcodes-how-to-use-shortcodes-in-wordpress-theme-examples/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1914</post-id>	</item>
		<item>
		<title>Fix for: Fatal error: Call to undefined function get_avatar_url() in /wp-content/plugins/jetpack/functions.opengraph.php on line 104</title>
		<link>https://theextremewebdesigns.com/blog/fix-for-fatal-error-call-to-undefined-function-get_avatar_url-jetpack-functions-opengraph/</link>
					<comments>https://theextremewebdesigns.com/blog/fix-for-fatal-error-call-to-undefined-function-get_avatar_url-jetpack-functions-opengraph/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 02 Nov 2012 10:08:09 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1409</guid>

					<description><![CDATA[Do you use the JetPack plugin (from WordPress) on your website? Did you just start seeing an error when you visit the Authors page on your WordPress blog? Or did you see the following error anywhere on your blog: Fatal error: Call to undefined function get_avatar_url() in public_html/wp-content/plugins/jetpack/functions.opengraph.php on line 104? If yes, then just note that until this [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Do you use the JetPack plugin (from WordPress) on your website? Did you just start seeing an error when you visit the Authors page on your WordPress blog? Or did you see the following error anywhere on your blog: <strong>Fatal error: Call to undefined function get_avatar_url() in public_html/wp-content/plugins/jetpack/functions.opengraph.php on line 104?</strong> If yes, then just note that until this issue is fixed your blog would continue to show such an error, which is not nice to look at and does not provide any value to your visitors. So in this article, I am going to share with you few ways to fix this problem. Read on to find the solution.<span id="more-1409"></span></p>
<h2>Root of the problem: JetPack Plugin</h2>
<p>Ok, so if you have recently started to see this error on your blog, then just know that this problem is occurring because of the JetPack plugin (from WordPress). Although I can&#8217;t give an exact reason why that happened, but it seems like when the developers updated the plugin, somehow they forgot to include the get_avatar_url() function or accidentally deleted it. Either ways, it renders plugin useless for you and your visitors. So if you would like to fix this error yourself, here are a couple of ways.</p>
<h2>Solution 1 to fix the fatal error: Call to undefined function get_avatar_url()</h2>
<p>This solution is by far, the simplest &amp; would not need any technical expertise on your part. Simply navigate to the Plugins menu option from within the Admin panel links &amp; browse to the JetPack plugin &amp; click Deactivate. This will deactivate the plugin &amp; this problem should be resolved if you visit the page &amp; reload it.</p>
<h2>Solution 2 to fix the fatal error: Call to undefined function get_avatar_url()</h2>
<p>This solution is technical &amp; I suggest you to go with the Solution 1 above, unless you are familiar with at least a bit of technical coding or if you really want to avoid making any changes to any files yourself. Should you want to go ahead &amp; make this change yourself, here&#8217;s what you should do:</p>
<p>1. You will need to add some code to functions.php file of your theme. If you have your theme locally, then navigate to your theme folder and edit the functions.php file. If you don&#8217;t have the theme locally and you have your blog online, navigate to the theme of your blog using FTP.  So for example, it would be something like:</p>
<p><strong>/wp-content/themes/my_theme/</strong></p>
<p>Download the functions.php file from the folder to your desktop and then edit it using a HTML editor. If you have Notepad installed in your system, that shall suffice.</p>
<p>2. Once you have opened the functions.php file in your software, simply paste the following code on the last line of the file, if the last line does not have the following symbols &#8220;?&gt;&#8221; (without quotes). The ?&gt; means that it is the closing tag for PHP. So if that ending tag exists, then you will need to paste the code, just above that line. Of if that closing tag is missing, then you may paste the following code on the last line:</p>
<pre class="lang:php decode:true">if ( !function_exists('get_avatar_url') )
{
function get_avatar_url($id_or_email, $size = '96', $default = '', $alt = false) {
if (! get_option('show_avatars')) { return false; }

if (false === $alt) { $safe_alt = ''; }
else { $safe_alt = esc_attr($alt); }

if (!is_numeric($size)) { $size = '96'; }

$email = '';
if (is_numeric($id_or_email)) {
$id = (int) $id_or_email;
$user = get_userdata($id);
if ($user) { $email = $user-&gt;user_email; }
}

elseif (is_object($id_or_email)) {
// No avatar for pingbacks or trackbacks
$allowed_comment_types = apply_filters('get_avatar_comment_types', array( 'comment'));
if (!empty($id_or_email-&gt;comment_type) &amp;&amp; ! in_array($id_or_email-&gt;comment_type, (array) $allowed_comment_types)) { return false; }

if (!empty($id_or_email-&gt;user_id)) {
$id = (int) $id_or_email-&gt;user_id;
$user = get_userdata($id);
if ($user) { $email = $user-&gt;user_email; }
}

elseif ( !empty($id_or_email-&gt;comment_author_email) ) { $email = $id_or_email-&gt;comment_author_email; }
}

else { $email = $id_or_email; }

if (empty($default)) {
$avatar_default = get_option('avatar_default');
if (empty($avatar_default)) { $default = 'mystery'; }
else { $default = $avatar_default; }
}

if (!empty($email)) { $email_hash = md5(strtolower($email)); }

if (is_ssl()) { $host = 'https://secure.gravatar.com'; }
else {
if (!empty($email)) { $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash{0} ) % 2 ) ); }
else { $host = 'http://0.gravatar.com'; }
}

if ('mystery' == $default) {
$default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
}
elseif ('blank' == $default) { $default = includes_url('images/blank.gif'); }
elseif (!empty($email) &amp;&amp; 'gravatar_default' == $default) { $default = ''; }
elseif ('gravatar_default' == $default) { $default = "$host/avatar/s={$size}"; }
elseif (empty($email)) { $default = "$host/avatar/?d=$default&amp;amp;s={$size}"; }
elseif (strpos($default, 'http://') === 0) { $default = add_query_arg('s', $size, $default); }

if (!empty($email)) {
$out = "$host/avatar/";
$out .= $email_hash;
$out .= '?s='.$size;
$out .= '&amp;amp;d=' . urlencode($default);

$rating = get_option('avatar_rating');
if (!empty($rating)) { $out .= "&amp;amp;r={$rating}"; }

//$avatar = "&lt;img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' /&gt;";
$avatar = $out;
}

else {
//$avatar = "&lt;img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' /&gt;";
$avatar = $default;
}

return $avatar;

}
}</pre>
<p>3. Once you have added the above code to functions.php file, save it. Then upload this file back to the your theme folder of your blog.</p>
<p>4. Visit the author page and reload it. If you have done everything correctly, the problem should now be resolved!</p>
<p>Now that you can use any of the above methods to solve the issue, don&#8217;t let this create a negative impression of the plugin on you. The developers at WordPress are great &amp; I do respect them for all the hard work, time &amp; efforts they have put in to develop a product that we all can use and especially because it&#8217;s free. I am a developer myself so I totally understand that such accidents can happen once in a while &amp; occurrence of the problem was unintentional. And now would be the right time for us all to show our appreciation to the WordPress guys by supporting them in such a time of crisis.</p>
<p>So just don&#8217;t go about deleting the plugin &amp; don&#8217;t go about making a promise to yourself not to use their plugin(s) in future. Rather, I suggest you wait for them to release an official patch or update so that the problem can be fixed &amp; just continue to use the plugin if you really like the way it works for you.</p>
<p><strong>Happy blogging!</strong></p>
<p>Did you use any of the above solutions to <em><strong>fix the Fatal error: Call to undefined function get_avatar_url() in /plugins/jetpack/functions.opengraph.php on line 104 problem in WordPress</strong>?</em> If yes, feel free to share your experiences by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/fix-for-fatal-error-call-to-undefined-function-get_avatar_url-jetpack-functions-opengraph/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1409</post-id>	</item>
		<item>
		<title>WordPress Last Insert ID &#124; Get wpdb Last Insert ID in while loop</title>
		<link>https://theextremewebdesigns.com/blog/wordpress-last-insert-id-get-wpdb-last-insert-id-in-while-loop/</link>
					<comments>https://theextremewebdesigns.com/blog/wordpress-last-insert-id-get-wpdb-last-insert-id-in-while-loop/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 31 Oct 2012 23:24:14 +0000</pubDate>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1379</guid>

					<description><![CDATA[WordPress Last Insert ID : In WordPress, at some point or the other, you may have come across a situation where you would need to get the last insert id i.e. the value of the auto-increment column as a result of insert operation performed. If you are running a normal SQL query, you would get the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>WordPress Last Insert ID :</strong> In WordPress, at some point or the other, you may have come across a situation where you would need to get the last insert id i.e. the value of the auto-increment column as a result of insert operation performed. If you are running a normal SQL query, you would get the last insert ID using mysql_insert_id(). But do you know how to <strong>get the last inserted row ID in WordPress</strong>? It&#8217;s very simple &amp; the code is just 1 line. Read on to find out the solution.</p>
<p><span id="more-1379"></span></p>
<h2>In WordPress, get Last Insert ID using wpdb  in while loop</h2>
<p>Let&#8217;s assume that you are working with WordPress and that you are inserting multiple products into the database using a custom for/foreach loop. In order to find out the last inserted row ID, you would generally use mysql_insert_id(). So now, we would need the equivalent of the mysql_insert_id() in WordPress using wpdb. <strong>We can get the last inserted id in WordPress using the following code</strong>:</p>
<pre class="lang:php decode:true">$last_inserted_id = $wpdb-&gt;insert_id;</pre>
<p>So just place the above line of code, just below the actual wpdb query. Following is an example:</p>
<pre class="lang:php decode:true">$result = $wpdb-&gt;query( "INSERT INTO $table_name ( col1, col2 ) VALUES ( '$col1', '$col1' )");

$last_inserted_id = $wpdb-&gt;insert_id;</pre>
<p>So that&#8217;s how you can get the last inserted row ID value in WordPress.</p>
<h5>Simple, isn&#8217;t it?</h5>
<p>Do you know of any other ways to <strong>get the last inserted ID in WordPress</strong>? Feel free to share by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/wordpress-last-insert-id-get-wpdb-last-insert-id-in-while-loop/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1379</post-id>	</item>
		<item>
		<title>WordPress Shortcodes Not Working? Make Shortcodes work in Theme,Plugin</title>
		<link>https://theextremewebdesigns.com/blog/wordpress-shortcodes-not-working-make-shortcodes-work-in-themeplugin/</link>
					<comments>https://theextremewebdesigns.com/blog/wordpress-shortcodes-not-working-make-shortcodes-work-in-themeplugin/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 28 Oct 2012 05:16:23 +0000</pubDate>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress-tips]]></category>
		<guid isPermaLink="false">https://theextremewebdesigns.com/blog/?p=1369</guid>

					<description><![CDATA[Shortcodes in WordPress are a result of the Shortcode API, introduced in WordPress 2.5. Shortcodes are a simple set of functions for creating macro codes for use in content and can be used in Themes, Plugins, etc. At times, it&#8217;s possible that you may have used a shortcode in a Theme or a Plugin &#38; expected [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><strong>Shortcodes</strong> in WordPress are a result of the Shortcode API, introduced in WordPress 2.5. Shortcodes are a simple set of functions for creating macro codes for use in content and can be used in Themes, Plugins, etc. At times, it&#8217;s possible that you may have used a shortcode in a Theme or a Plugin &amp; expected it to work correctly but that didn&#8217;t happen. Or you might have noticed that the shortcodes stopped working after you made some changes to the existing code. If shortcodes stop working, then the functionality related to it is completely lost. So how to fix this? In this article, I am going to share some ways of <strong>fixing the WordPress shortcodes in a theme or plugin</strong>. Read to find out how.<span id="more-1369"></span></p>
<h2>WordPress Shortcodes Not Working? Try these fixes</h2>
<p>Ok so let&#8217;s discuss this with a very practical example. Once I am finished with that, I will list out some other general ways that you can use to fix the shortcodes issue.</p>
<p>Just recently, I was working on a WordPress theme that required me to work with custom WordPress queries &amp; change the content as per requirement. I was using <strong>get_the_content()</strong> to show the content. I had the WP Table Reloaded plugin running &amp; I created a table with some data in it. (If you haven&#8217;t heard about it, then it is a very good plugin that lets you present data in tabular format. It&#8217;s the best plugin I have seen so far, when it comes to handling &amp; presenting tables. You can check it out by visiting the official WordPress Website or by <a title="WP Table Reloaded" href="http://wordpress.org/extend/plugins/wp-table-reloaded/" target="_blank">clicking here</a>). I took the shortcode generated by the plugin, inserted it into a new post &amp; saved the post. When I visited the website frontend, I noticed that the table is missing! How could it be? I checked everything again &amp; could not find any possible issue. Upon further inspection, I found out that the shortcodes were completely ignored and they were never parsed. And then, I applied the following solution to make the shortcodes work.</p>
<h3>Make shortcodes work for Post content for a custom WordPress Query</h3>
<pre class="lang:php decode:true">do_shortcode( get_the_content() );</pre>
<p>That&#8217;s it! I saved the code &amp; when I refreshed the frontend, the tables showed up normally! So if you are absolutely sure that the shortcodes exist but they dont seem to work, then simply apply the function do_shortcode() on the resultant content to make the shortcodes work.</p>
<p>Ok, now that I discussed a specific practical example on how to make shortcodes work for content derived by using a custom WordPress query, I am going to list out some other general ways to make shortcodes work, should the above procedure not be applicable to your case:</p>
<h3>Make shortcodes work on Post Content / Page Content for a standard WordPress Query</h3>
<pre class="lang:php decode:true">&lt;?php
apply_filters( 'the_content', '[shortcode]' );
?&gt;</pre>
<h3>Make shortcodes work from within a Theme instead of with the content of a Post Content / Page Content and supply custom attributes for the shortcode</h3>
<p><strong>Example 1: Simplest form of Shortcode</strong></p>
<pre class="lang:php decode:true">&lt;?php
echo do_shortcode( '[myshortcode]' );
?&gt;</pre>
<p><strong>Example 2: C<strong>ustom values being passed to </strong>Shortcode &#8211; Method 1</strong></p>
<pre class="lang:php decode:true">&lt;?php
echo do_shortcode( '[myshortcode=id:1; attribute1:100; attribute2:someValue;]' );
?&gt;</pre>
<p><strong>Example 3: <strong>C<strong>ustom values being passed to </strong>Shortcode &#8211; Method 2</strong></strong></p>
<pre class="lang:php decode:true">&lt;?php
echo do_shortcode( '[myshortcode tag="Some tag" type="Some type"]' );
?&gt;</pre>
<p><strong>Example 4: Using opening and closing shortcode</strong></p>
<pre class="lang:php decode:true">&lt;?php
echo do_shortcode( '[myshortcode] Some custom text or value [/myshortcode]' );
?&gt;</pre>
<h3>Make Shortcodes work and add custom field along with its value within shortcode</h3>
<pre class="lang:php decode:true">&lt;?php
$rating_value = get_post_meta($post-&gt;ID, 'rating', true);

if ( trim($rating_value) != '' )
{
echo do_shortcode( '[shortcode post_id="'.$post-&gt;ID.'" rating="' . $rating_value . '" type="oldest"]');
}
?&gt;</pre>
<p>The code above may require some explanation, so here it goes. What we are essentially doing here is, we have a custom field in wp_postmeta table with meta_key &#8216;rating&#8217;. So in the first line, we are trying to fetch the value of this rating for the post_id as indicated. Now we want to pass this rating value to our shortcode so that the shortcode can grab, parse &amp; read the rating value and use it for internal calculations &amp; show output based on the same. So in the 2nd line, we are making sure that rating_value is not empty. And once we are positive that a rating exists, we are specifying the shortcode and passing the rating value by specifying the key &#8216;rating&#8217; &amp; assigning the &#8216;rating_value&#8217; to it. Note that we are also passing some other values such as the post_id &amp; the type.</p>
<p><strong>IMPORTANT NOTES:</strong></p>
<p>1. <strong>Make sure to single quote just before and after the square braces</strong>. Do <strong>NOT</strong> use double quotes or the solution(s) may not work.</p>
<p>2. <strong>Use echo</strong> in front of do_shortcode if you are using the code as <strong>standalone in your theme</strong>. If you are using do_shortcode on content from a post/page, then you may skip specifying echo.</p>
<p>I hope this article helped you more on understanding how shortcodes were designed to work and how you can troubleshoot and solve issues, should you find that any <strong>shortcodes are not working in WordPress theme or plugin</strong>.</p>
<h5>Your Turn!</h5>
<p>Do you know of any other ways to <strong>make shortcodes work in WordPress</strong>? Feel free to suggest by commenting below.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://theextremewebdesigns.com/blog/wordpress-shortcodes-not-working-make-shortcodes-work-in-themeplugin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1369</post-id>	</item>
	</channel>
</rss>
