<?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 code Archives - Postnidea</title>
	<atom:link href="https://www.postnidea.com/tag/wordpress-code/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.postnidea.com/tag/wordpress-code/</link>
	<description>Programming Blog, Tutorials, jQuery, Ajax, PHP, MySQL and Demos</description>
	<lastBuildDate>Tue, 27 May 2025 09:13:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2.8</generator>

<image>
	<url>https://www.postnidea.com/wp-content/uploads/2019/08/favicon.ico</url>
	<title>wordpress code Archives - Postnidea</title>
	<link>https://www.postnidea.com/tag/wordpress-code/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>6 tips for optimized and secure WordPress during development</title>
		<link>https://www.postnidea.com/6-tips-for-optimized-and-secure-wordpress-during-development/</link>
		
		<dc:creator><![CDATA[Rakesh Kumar]]></dc:creator>
		<pubDate>Mon, 11 Nov 2019 05:17:36 +0000</pubDate>
				<category><![CDATA[woocommerce]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[Plugin development]]></category>
		<category><![CDATA[wordpress code]]></category>
		<guid isPermaLink="false">https://www.postnidea.com/?p=229</guid>

					<description><![CDATA[<p>WordPress is a very popular CMS. All-around the world most of the sites are built using WordPress. WordPress is available [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.postnidea.com/6-tips-for-optimized-and-secure-wordpress-during-development/">6 tips for optimized and secure WordPress during development</a> appeared first on <a rel="nofollow" href="https://www.postnidea.com">Postnidea</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>WordPress is a very popular CMS. All-around the world most of the sites are built using WordPress. WordPress is available for users in two ways. It&#8217;s also usable for the blogger they can be used without any cost. The users need to just sign up on the wordpress.com &amp; start writing a post for the blog. The wordpres.com is responsible for all other challenges like maintenance, uptime &amp; optimization. It also avails a lot of things for users like theme widgets. If you interested more then you go through the <a href="https://wordpress.com/start/user?ref=postnidea">link</a>.</p>
<p>The second option for the user is self-hosted WordPress. In this WordPress provide you setup in zip format so that user can download it. Now the user has good command over the blog or website. He can do everything whichever he wants. The WordPress is hosted on user hosting so the user will responsible for other things like performance, security, SEO &amp; blog uptime.<br />
Today I want to explain some other things so I don&#8217;t want to go in deep knowledge.</p>
<p>Generally, people have the myth WordPress not more secure or you can develop an only simple informational site. But It&#8217;s completely wrong you can develop anything using WordPress &amp; will work securely. WordPress CMS is a gravy of your dish So, it depends upon you how to use if you maintain a WordPress coding standard then definitely your application will generate good revenue. Today I will share some points which should be kept in mind from the phase of development. So after development when you start work for the security &amp; performance then your work effort become decrease. These are very basic things but most of the peoples missed it. I have created a list of these which is below.</p>
<h2>Perfect placement of files.</h2>
<p>when things are placed properly then they make sense otherwise difficult to maintain. So whenever you create a theme or plugin then maintain the proper standard file structure. I have shown you a file structure for the plugin is below.</p>
<p>One more important thing is that always make plugin frontend compatible by using templates &amp; they should be overridable so that easy to use plugin &amp; override frontend without editing plugin. Same thing I also suggest for the theme So that in future if there is an issue in this case if the standard structure is there then easy to any developer debug.</p>
<h2>Naming convention &amp; declaration of variable, constant</h2>
<p>In programming, the naming convention very important, especially in WordPress, try to define the unique name of the variable, constant &amp; class so there is less chance to conflict with other plugins. The variable value used recursively then it should define in the starting lines. Because some time value fills in the variable from the database or some other where if we not define then it always triggers database query or procedure. The name of the variable &amp; constant should be meaning full so that easy to code review.</p>
<h2>Maximum use of WordPress core things</h2>
<p>The peoples are used the opensource because most of the things already built in it. The open-source provides a collection of hooks, filters &amp; methods we need to use them. The benefit of using them is that if the upgrade or maintain anything in these then your functionality never breaks &amp; you will also not need to eject the latest changes in our functionality. If you use inbuilt functions again and again then your development speed also increases because after a certain time you will grasp up maximum functions.</p>
<h2>wp-config usage</h2>
<p>The wp-config.php is the main configuration file for the WordPress in which all settings like DB &amp; constant defined in it. It gets all details from a wp-config.php file like database, salt keys, cache, debug, etc. So always use the defined constant, sometimes peoples defined error display enable/ disable using functions.php which wrong practice. So bad practice of code always consumes more time during maintenance or enhancements.</p>
<h2>Proper versioning</h2>
<p>Version controlling is the process by which we identify a change chain log. It will greatly help in issue debug. So whenever you add major changes in the plugin then the version of the plugin should be updated. Always use the updated plugin because of sometimes plugin developer done the major things related to security if you miss that update then you will eject security threat in the application.</p>
<h2>Proper security during code</h2>
<p>During the coding, security should be very important otherwise your application is not beneficial for the user because the hacker can easily break it. So always use the input sanitization. For sanitization, WordPress provides lots of functions which is already available. During the installation of WordPress setup change the salt keys, Database prefix should be changed from the default which will add one more step towards the security.</p>
<h2>proper understanding of the functions (fastest &amp; best function)</h2>
<p>In WordPress for a certain task available multiple hooks &amp; functions so review the function properly &amp; try to understand the code of function then use the most efficient appropriate function instead of any function.</p>
<h2>Avoid modifying core, plugin, parent them</h2>
<p>In any opensource, if you changed the core files then you simply break the updates or functionality. Another most important thing is that whenever you get a new update then your customization becomes goes. So always try to implement our requirement in the child theme or our theme so that no need to customize core.</p>
<h2>Not Checking If a Plugin Is Active</h2>
<p>If your code dependent on the certain plugin of class then always implement the checks so that if the dependent thing is not available then, in that case, your functionality or plugin can&#8217;t be a break. You can apply plugin checks using the below code.<br />
if ( is_plugin_active( &#8216;plugin-folder/plugin-main-file.php&#8217; ) ) {<br />
// Run plugin code<br />
}<br />
In the same way, you should also need to apply the function, class checks.</p>
<h2>Loading Too Many Resources</h2>
<p>Never load CSS and js in head or footer directly because it&#8217;s bad practice. Sometimes I have seen that people add the jquery library, juqrey-ui library or other libraries (default) which is standard and already available in the core then why people are used. Always add CSS &amp; js using below functions which standard. Always try to use standard functions for these tasks which are below.</p>
<h2>Keeping the Admin Bar</h2>
<p>During the initial time, I disabled the admin bar for checking responsive &amp; other things. But it&#8217;s bad practice it will lose the user experience. So always keep the admin-bar visible so that end-user can perform default functions like editing, view navigate dashboard easily.</p>
<h2>Not Utilizing the GetText Filter[translatable]</h2>
<p>Different people have different region but they want to taste your recipe (themes, plugin). But translation is not available to our audience that is the biggest problem. If such type of issue present then your plugin or theme will not use more. So always create textdomain &amp; load at the time of theme or plugin load so that your stuff becomes translatable. The WordPress translate plugin like loco translate, wpml both, is used the textdomain &amp; translate your stuff in the user language.</p>
<p>The things which I know &amp; faced I have to explain to you. I think if you follow these things your application has good performance &amp; secured. If you do the above things then at the time security &amp; performance optimization you will save a lot of time. If you have more things about the above then you can share it with us. I always welcome suggestions &amp; feedback.</p>
<p>The post <a rel="nofollow" href="https://www.postnidea.com/6-tips-for-optimized-and-secure-wordpress-during-development/">6 tips for optimized and secure WordPress during development</a> appeared first on <a rel="nofollow" href="https://www.postnidea.com">Postnidea</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress template get custom parameter with SEO URL</title>
		<link>https://www.postnidea.com/wordpress-template-get-custom-parameter-with-seo-url/</link>
					<comments>https://www.postnidea.com/wordpress-template-get-custom-parameter-with-seo-url/#respond</comments>
		
		<dc:creator><![CDATA[Rakesh Kumar]]></dc:creator>
		<pubDate>Tue, 23 Aug 2016 03:13:00 +0000</pubDate>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[get parameter]]></category>
		<category><![CDATA[SEO friendly URL]]></category>
		<category><![CDATA[wordpress code]]></category>
		<guid isPermaLink="false"></guid>

					<description><![CDATA[<p>In wordpress development every developer use the template. Its the great feature that provide by the wordpress so that you [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.postnidea.com/wordpress-template-get-custom-parameter-with-seo-url/">WordPress template get custom parameter with SEO URL</a> appeared first on <a rel="nofollow" href="https://www.postnidea.com">Postnidea</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div dir="ltr" style="text-align: left;">
<p style="text-align: justify;">In wordpress development every developer use the template. Its the great feature that provide by the wordpress so that you add the custom design &amp; layout. In the theme development the designer &amp; developer well play with theme template. Various plugin also provide the template functionality so that you can also modify there plugin template also use of the template modification facility.</p>
<p style="text-align: justify;">There is some free &amp; famous plugin like buddypress,woocommerce &amp; ultimate member plugin that provide the template facility. With help of template facility in woocommerce you can modify the product page, product listing page according design. Same case with buddypress there multiple section available. Actually its the social network plugin. There is various sections are there like member profile, activity, message &amp; settings. These section also have same template facility so you can without modification in the plugin you can modify the design of the website.</p>
<p style="text-align: justify;">Now problem came out when you need the get the parameter on the custom template. For example you want create the template for the user profiling. So representing the user profile you need to username or user_id from the URL. With the help of that you can extract the data of the user. With default functionlity of wordpress you cant be get. There is need to custom code. Now i will show you how to access the code.</p>
<p><script src="https://gist.github.com/rakeshkumar125/5c3d30238f06d66eb54b10582a67abb0.js"></script></p>
<p style="text-align: justify;">In above code you have seen function add_query_var() that modify default query_var of the wordpress. Then this function add in hook in below line. Now after that work you have modify the wordpress default query now need to get the parameter in our template so code after that code paste in the template or in the funtions.php with all code. then you will be get the parameter on our template.</p>
</div>
<p>The post <a rel="nofollow" href="https://www.postnidea.com/wordpress-template-get-custom-parameter-with-seo-url/">WordPress template get custom parameter with SEO URL</a> appeared first on <a rel="nofollow" href="https://www.postnidea.com">Postnidea</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.postnidea.com/wordpress-template-get-custom-parameter-with-seo-url/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to add css &#038; jquery file in wordpress</title>
		<link>https://www.postnidea.com/how-to-add-css-jquery-file-in-wordpress/</link>
					<comments>https://www.postnidea.com/how-to-add-css-jquery-file-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[Rakesh Kumar]]></dc:creator>
		<pubDate>Tue, 21 Jan 2014 12:22:00 +0000</pubDate>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress plugin]]></category>
		<category><![CDATA[enqueue css/js]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress code]]></category>
		<guid isPermaLink="false">http://www.postnidea.com/2014/01/21/how-to-add-css-jquery-file-in-wordpress/</guid>

					<description><![CDATA[<p>The addion of javascript &#38; css to the wordpress theme or plugin it common task. If you envolve in the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://www.postnidea.com/how-to-add-css-jquery-file-in-wordpress/">How to add css &#038; jquery file in wordpress</a> appeared first on <a rel="nofollow" href="https://www.postnidea.com">Postnidea</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>The addion of javascript &amp; css to the wordpress theme or plugin it common task. If you envolve in the wordpress development then I hope you were faced regular basis. But question is that how to add these things in the proper manner. I will show you how to add these. Always use the wordpress functions for enqueue css &amp; js.</p>
<p>Below functoin should need to be add on the particular action of wordpress which trigger on very first like init, load, etc. Once it&#8217;s triggered then it will include the css and js function which is included int the function &#8220;function_include_css_js&#8221;.</p>
<pre><code>
add_action( 'wp_enqueue_scripts', 'function_include_css_js');
</code></pre>
<p>Now we need to write the defination of the function &amp; calling the css js file. Please review the below code.</p>
<pre><code>
function function_include_css_js(){

	wp_enqueue_style('unique_css_handle', plugins_url( 'assests/css/your_file.css', __FILE__ ));
    wp_enqueue_script('unique_js_handle', plugins_url( 'assests/js/your_script.js', __FILE__ ),array('jquery'), '2.1');
}
</code></pre>
<p>In above code you can see that I have used the function &#8220;wp_enqueue_style&#8221; for css so that the css file will include in the top of the site. Another function for the javascript. For both function need to use uniuqe handle which use for adding the css/js in the website.</p>
<p>Same way you can also enque the wordpress varaible &amp; values to the javascript varible. I have added the code please review it.</p>
<pre><code>
// Localize the script with new data
$yourVar = array(
	'siteName' =&gt; "Postnidea",
	'author' =&gt; 'Rakesh Kumar'
);
wp_localize_script( 'unique_js_handle', 'your_object', $yourVar);
</code></pre>
<p>In above code you see that I have created a object &#8220;your_object&#8221; with the help of this object you can access all the values. For example if you want access siteName then you can access like that your_object.siteName .</p>
<p>So, I hope my thoughts will help you getting some information regarding &#8220;How to add css &amp; jquery file in wordpress&#8221; topic. if you have any suggestion or mistake please share with us.</p>
<p>The post <a rel="nofollow" href="https://www.postnidea.com/how-to-add-css-jquery-file-in-wordpress/">How to add css &#038; jquery file in wordpress</a> appeared first on <a rel="nofollow" href="https://www.postnidea.com">Postnidea</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.postnidea.com/how-to-add-css-jquery-file-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
