<?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 Archives &#8212; Stampede: the strategic design &amp; technology company</title>
	<atom:link href="https://stampede-design.com/blog/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>https://stampede-design.com/blog/tag/wordpress/</link>
	<description>We are creating better worlds though thoughtful design and technology. Connect with us!</description>
	<lastBuildDate>Tue, 07 Apr 2026 10:04:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.7</generator>

<image>
	<url>https://stampede-design.com/wp-content/uploads/2024/02/cropped-Stampede-Favicon-old-32x32.png</url>
	<title>WordPress Archives &#8212; Stampede: the strategic design &amp; technology company</title>
	<link>https://stampede-design.com/blog/tag/wordpress/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Creating a Custom Block Type for WordPress Gutenberg Editor</title>
		<link>https://stampede-design.com/blog/creating-a-custom-block-type-for-wordpress-gutenberg-editor/</link>
					<comments>https://stampede-design.com/blog/creating-a-custom-block-type-for-wordpress-gutenberg-editor/#respond</comments>
		
		<dc:creator><![CDATA[Shaiful Borhan]]></dc:creator>
		<pubDate>Wed, 20 Feb 2019 09:14:16 +0000</pubDate>
				<category><![CDATA[Field Notes]]></category>
		<category><![CDATA[block editor]]></category>
		<category><![CDATA[front-end development]]></category>
		<category><![CDATA[Gutenberg]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://stampede-design.com/?p=9619</guid>

					<description><![CDATA[<p>For all the buzz it has generated in 2018, you would need to be a hermit (or at least someone who doesn’t work in web-development) to not have heard of WordPress version 5.&#160;I&#8217;m of course referring to its game-changing feature — the new block-based editor, Gutenberg. The new editor radically changes the writing experience in&#8230;<a href="https://stampede-design.com/blog/creating-a-custom-block-type-for-wordpress-gutenberg-editor/"> Keep reading</a></p>
<p>The post <a href="https://stampede-design.com/blog/creating-a-custom-block-type-for-wordpress-gutenberg-editor/">Creating a Custom Block Type for WordPress Gutenberg Editor</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="lead">For all the buzz it has generated in 2018, you would need to be a hermit (or at least someone who doesn’t work in web-development) to not have heard of WordPress version 5.&nbsp;I&#8217;m of course referring to its game-changing feature — the new block-based editor, Gutenberg. The new editor radically changes the writing experience in WordPress because of its block-based system. Content authors can now treat content editing with more of a page building approach, akin to popular page-builders like Elementor and Divi.</p>



<p>Gutenberg by default comes with a handful of block types that should cover standard web content updating needs. However, it also has a nifty&nbsp;<a href="https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/" target="_blank" rel="noopener noreferrer">Block API</a> for adding custom block types if you need them to display specially designed components for our website. In this tutorial, you are going to add a custom Gutenberg block type so that the output is a notice box with a few predefined styles that accepts arbitrary text input from the user.</p>



<p>This is what you&#8217;re going for.</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="999" height="339" src="https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-output.png" alt="" class="wp-image-9622" srcset="https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-output.png 999w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-output-300x102.png 300w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-output-768x261.png 768w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-output-790x268.png 790w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-output-280x95.png 280w" sizes="(max-width: 999px) 100vw, 999px" /><figcaption> Our custom Notice blocks’ final output. Please ignore the crude styling because that’s not really in the scope of this tutorial. </figcaption></figure>



<p class="afterimagecaption">And here is how it looks from the admin&#8217;s side.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1274" height="866" src="https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-admin.gif" alt="" class="wp-image-9621"/><figcaption> How admins would interact with the custom Notice block. </figcaption></figure>



<p class="afterimagecaption">Alright, let&#8217;s get to coding!</p>



<h2 class="wp-block-heading">Step 1: Create a plugin for the new block type</h2>



<p>You will be creating a custom block type as a WordPress plugin. This will allow you to decouple it from any themes you are using and in case anything goes wrong, you can simply deactivate it.</p>



<p>So create a new folder in the WP plugins folder and let&#8217;s call it <code>gutenberg-notice-block</code>. In this new folder, create a <code>plugin.php</code> file with the following code:</p>



<pre class="wp-block-code"><code lang="php" class="language-php line-numbers">/**
* Plugin Name: Gutenberg Notice Block
* Author: Shaiful
* Description: A notice box with a few predefined styles that accepts arbitrary text input.
* Version: 1.0
*/

// Load assets for wp-admin when editor is active
function shaiful_gutenberg_notice_block_admin() {
   wp_enqueue_script(
      'gutenberg-notice-block-editor',
      plugins_url( 'block.js', __FILE__ ),
      array( 'wp-blocks', 'wp-element' )
   );

   wp_enqueue_style(
      'gutenberg-notice-block-editor',
      plugins_url( 'block.css', __FILE__ ),
      array()
   );
}

add_action( 'enqueue_block_editor_assets', 'shaiful_gutenberg_notice_block_admin' );

// Load assets for frontend
function shaiful_gutenberg_notice_block_frontend() {

   wp_enqueue_style(
      'gutenberg-notice-block-editor',
      plugins_url( 'block.css', __FILE__ ),
      array()
   );
}
add_action( 'wp_enqueue_scripts', 'shaiful_gutenberg_notice_block_frontend' );</code></pre>



<p>Basically what this file does is initialise the plugin by loading the necessary JS and CSS files at the right place and at the right time. The code above is looking for <code>block.js</code> and <code>block.css</code>, which you will create momentarily.</p>



<p>At this point, you should be able to see the new plugin listed in your WP Plugins admin page. Go ahead and activate it.</p>



<p>Moving forward, all of your coding will be done in JavaScript with some ReactJS flavour to interact with the Gutenberg Block API.</p>



<h2 class="wp-block-heading">Step 2: Register the new block type</h2>



<p>Create a file called <code>block.js</code> in your custom plugin folder. This file will hold the entire logic of the custom block type for the admin-side and frontend of your website.</p>



<p>Start by adding the following bare-bones code.</p>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript line-numbers">/* block.js */
var el = wp.element.createElement;

wp.blocks.registerBlockType('shaiful-gutenberg/notice-block', {

   title: 'Notice', // Block name visible to user

   icon: 'lightbulb', // Toolbar icon can be either using WP Dashicons or custom SVG

   category: 'common', // Under which category the block would appear

   attributes: { // The data this block will be storing

      type: { type: 'string', default: 'default' }, // Notice box type for loading the appropriate CSS class. Default class is 'default'.

      title: { type: 'string' }, // Notice box title in h4 tag

      content: { type: 'array', source: 'children', selector: 'p' } /// Notice box content in p tag

   },

   edit: function(props) {
      // How our block renders in the editor in edit mode
      return null;
   },

   save: function(props) {
      // How our block renders on the frontend
      return null;
   }
});
</code></pre>



<p>The code above registers your new block type with the name “Notice”, using a light-bulb <a href="https://developer.wordpress.org/resource/dashicons/" target="_blank" rel="noopener noreferrer">Dashicon</a> and putting it under the Common Blocks panel in the Gutenberg blocks browser. You should be able to see the new block in your editor at this point.</p>



<p>You also specify the attributes (and their data type) that your new block will be storing which are the box type, the box title and the box content.</p>



<p>Lastly, there are two functions called edit() and save(). The edit() function is responsible for rendering your block in the editor while the save() function outputs your block HTML on our website&#8217;s frontend.</p>



<p>Let&#8217;s explore them now.</p>



<h2 class="wp-block-heading">Step 3: The edit() function</h2>



<p>The edit() function controls how the block will appear in the Gutenberg editor for the user to interact with.</p>



<p>For your custom Notice block type, the goal is to accomplish two things:</p>



<ol class="wp-block-list"><li>The user can select the notice box type as well as enter the box title and content.</li><li>Selecting different notice box types will show a simple live preview of what the box is going to look like on the frontend.</li></ol>



<p>Add the following code into the edit() function.</p>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript line-numbers">/* block.js */
edit: function(props) {
   // How our block renders in the editor in edit mode

   function updateTitle( event ) {
      props.setAttributes( { title: event.target.value } );
   }

   function updateContent( newdata ) {
      props.setAttributes( { content: newdata } );
   }

   function updateType( event ) {
      props.setAttributes( { type: event.target.value } );
   }

   return el( 'div',
      {
         className: 'notice-box notice-' + props.attributes.type
      },
      el(
         'select',
         {
            onChange: updateType,
            value: props.attributes.type,
         },
         el("option", {value: "default" }, "Default"),
         el("option", {value: "success" }, "Success"),
         el("option", {value: "danger" }, "Danger")
      ),
      el(
         'input',
         {
            type: 'text',
            placeholder: 'Enter title here...',
            value: props.attributes.title,
            onChange: updateTitle,
            style: { width: '100%' }
         }
      ),
      el(
         wp.editor.RichText,
         {
            tagName: 'p',
            onChange: updateContent,
            value: props.attributes.content,
            placeholder: 'Enter description here...'
         }
      )
   ); // End return

},  // End edit()
</code></pre>



<p>Line 16-49 is the main code you will use to display the user interface in a way that allows you to update the content in your block type. The code is written in ReactJS specifically the React.createElement() function is used to create new DOM elements. Do not worry if ReactJS is unfamiliar to you. You can make use of <a href="https://babeljs.io/repl" target="_blank" rel="noopener noreferrer">this specific tool</a> to compile <a href="https://reactjs.org/docs/introducing-jsx.html" target="_blank" rel="noopener noreferrer">JSX template code</a> to React.createElement() functions.</p>



<p>Here is an example.</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1323" height="866" src="https://stampede-design.com/wp-content/uploads/2019/02/babel-compile-jsx-to-react.png" alt="" class="wp-image-9637" srcset="https://stampede-design.com/wp-content/uploads/2019/02/babel-compile-jsx-to-react.png 1323w, https://stampede-design.com/wp-content/uploads/2019/02/babel-compile-jsx-to-react-300x196.png 300w, https://stampede-design.com/wp-content/uploads/2019/02/babel-compile-jsx-to-react-768x503.png 768w, https://stampede-design.com/wp-content/uploads/2019/02/babel-compile-jsx-to-react-790x517.png 790w, https://stampede-design.com/wp-content/uploads/2019/02/babel-compile-jsx-to-react-229x150.png 229w" sizes="(max-width: 1323px) 100vw, 1323px" /><figcaption> Using Babel to compile JSX to ReactJS code. </figcaption></figure>



<p class="afterimagecaption">It&#8217;s a good idea to create your <code>block.css</code> file right now so that you can test the live preview functionality in the editor. Make sure the CSS file is saved in your plugin folder.</p>



<pre class="wp-block-code"><code lang="css" class="language-css line-numbers">/* block.css */
div.notice-box {
   border: 1px LightSkyBlue solid;
   border-left-width: 5px;
   padding: 10px 15px;
   margin: 30px;
}

div.notice-box.notice-success {
  border-color: MediumSpringGreen ;
}

div.notice-box.notice-danger{
   border-color: LightCoral ;
}

div.notice-box h4 {
   font-size: 18px;
   margin:0 0 10px 0;
}
div.notice-box p {
   font-size: 16px;
   line-height: 24px;
   margin:0;
}
</code></pre>



<p>At this point, you should be able to add your Notice block type into the editor and see three different fields for configuring the notice box. The dropdown for selecting the notice box type should also gives you a live preview between the default (blue), success (green) and danger (red) box types.</p>



<h2 class="wp-block-heading">Step 4: The save() function</h2>



<p>The save() function for your Notice block type is pretty straightforward. You just have to construct the correct HTML structure and populate the title and content into the notice box <code>&lt;div&gt;</code>. Once again the DOM elements creation code has to be written in ReactJS.</p>



<p>Here is the code:</p>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript line-numbers">/* block.js */
save: function(props) {
   // How our block renders on the frontend

   return el( 'div',
      {
         className: 'notice-box notice-' + props.attributes.type
      },
      el(
         'h4',
         null,
         props.attributes.title
      ),
      el( wp.editor.RichText.Content, {
         tagName: 'p',
         value: props.attributes.content
      })

   ); // End return

} // End save()
</code></pre>



<p>That&#8217;s it!</p>



<p>Your Notice block type should now work on both the admin and website&#8217;s frontend.</p>



<p>Here is the&nbsp;<a href="https://stampede-design.com/demo/gutenberg-notice-block.zip">link</a> to download the completed plugin.</p>



<h2 class="wp-block-heading">Something to keep in mind</h2>



<p>Looking at the save() function, you’d imagine that updating the HTML output in there would cause a global update for all instances of the Notice box that you have populated on your website. It’s natural to expect this (it is, at least from our experience with working with WP shortcodes). Unfortunately, this isn’t what happens.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1274" height="866" src="https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-error.png" alt="" class="wp-image-9620" srcset="https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-error.png 1274w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-error-300x204.png 300w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-error-768x522.png 768w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-error-790x537.png 790w, https://stampede-design.com/wp-content/uploads/2019/02/gutenberg-notice-block-error-221x150.png 221w" sizes="(max-width: 1274px) 100vw, 1274px" /></figure>



<p>Making any changes to the block HTML output would trigger a conflict with all existing instances of the blocks that have been populated. What&#8217;s worse is that the only way to fix this is by repopulating the blocks one by one. This is the caveat of static block types.</p>



<p>To work around this, make use of the&nbsp;<a href="https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/block-tutorial/creating-dynamic-blocks/" target="_blank" rel="noopener noreferrer">Dynamic Blocks</a>&nbsp;feature which hands over the save() function from JS to PHP to generate the block HTML output on the fly.</p>



<h2 class="wp-block-heading">Final thoughts</h2>



<p>The ability to create custom block types is very cool and opens a lot of possibilities for content customisation. After trying it out myself, I would say the basic concept is fairly easy to follow. The real challenge, however, is presenting the custom block in the best possible way to give content authors the best editing experience, especially for blocks with complex functionalities. I find that the official developer documentation for various attributes configurations or working with RichText field for example, are still lacking. It will improve surely but the best reference materials we have at this moment are online articles and the existing blocks that came out of the box with WP5.</p>



<p>On another note, I am personally looking forward to the Advanced Custom Fields (ACF) plugin taking on the custom block types with their own <a href="https://www.advancedcustomfields.com/blog/acf-5-8-introducing-acf-blocks-for-gutenberg/" target="_blank" rel="noopener noreferrer">ACF Blocks for Gutenberg</a>. This new addition should lower the barrier for WP developers to take advantage of Gutenberg block capabilities in a more intuitive way.</p>
<p>The post <a href="https://stampede-design.com/blog/creating-a-custom-block-type-for-wordpress-gutenberg-editor/">Creating a Custom Block Type for WordPress Gutenberg Editor</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stampede-design.com/blog/creating-a-custom-block-type-for-wordpress-gutenberg-editor/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WordPress CPT Solutions Comparison: Pods vs Types</title>
		<link>https://stampede-design.com/blog/wordpress-cpt-solutions-comparison-pods-vs-types/</link>
					<comments>https://stampede-design.com/blog/wordpress-cpt-solutions-comparison-pods-vs-types/#comments</comments>
		
		<dc:creator><![CDATA[Shaiful Borhan]]></dc:creator>
		<pubDate>Thu, 05 Feb 2015 17:43:15 +0000</pubDate>
				<category><![CDATA[Field Notes]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[CPT]]></category>
		<category><![CDATA[development tools]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://dev.stampedelabs.com/client/v3/wp/?p=6299</guid>

					<description><![CDATA[<p>Pods and Types are Shaiful's two favourite solutions when it comes to WordPress' custom post types. Here he will help you decide on the best one for you, depending on your project requirements.</p>
<p>The post <a href="https://stampede-design.com/blog/wordpress-cpt-solutions-comparison-pods-vs-types/">WordPress CPT Solutions Comparison: Pods vs Types</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Starting from WordPress 3.0, custom post types (CPT) has been one of WP&#8217;s most unrivaled core features. I cannot recall how many times this wonderful feature had came to the rescue to help me achieve CMS-like functionalities in custom WP projects. As WP users, you have probably used CPT directly, by coding on it or indirectly by installing plugins that create their own CPTs like WooCommerce.</p>
<p>Since a couple of years ago, I have pretty much refrained from coding CPTs from scratch, unless for extremely simple post types. I have sworn my allegiance to two well-known CPT solution plugins namely <a href="https://wordpress.org/plugins/pods/" target="_blank"><strong>Pods</strong></a> and <a href="https://wordpress.org/plugins/types/" target="_blank"><strong>Types</strong></a>. In this post, I&#8217;ll try my best to explain how they fare against each other, specifically on the way they handle CPTs (and custom taxonomies).  What I don&#8217;t intend to cover are extended features like user roles or data migration. Finally, there&#8217;s a bonus section about enhancing their functionalities.</p>
<h2>WordPress Pods plugin</h2>
<p><div class="full"><a href="https://wordpress.org/plugins/pods/" target="_blank"><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-6488" src="https://stampede-design.com/wp-content/uploads/2015/02/banner-772x2501.png" alt="Pods WordPress plugin" width="772" height="250" /></a></div></p>
<p>The CPT management screens in Pods are really well-done and user friendly. If you are new to the world of CPTs, Pods will present you with a gentle learning curve to get you up and running. When you create a new CPT or custom taxonomy, you immediately have access to the custom fields management panel within the same CPT or custom taxonomy edit page. This makes the whole process of managing the custom fields a breeze and feels natural.</p>
<p>These are the main strengths of Pods:</p>
<ol>
<li>Nice and intuitive user interface.</li>
<li>Large selection of custom field types.</li>
<li>You can add custom fields to custom taxonomies too.</li>
<li>Pods Template is an optional component you can enable in Pods to create templates for outputting Pods CPTs using magic tags and shortcodes all within WordPress without messing around with theme files.</li>
<li>You can create a custom Settings page for miscellaneous usage.</li>
</ol>
<p>The limitation of Pods based on my experience are:</p>
<ol>
<li>While you can create true parent-child (or one-to-many) relationships between Pods CPTs, the level of integration doesn&#8217;t appear to be truly seamless. For instance, in a property rental website <span data-dobid="hdw">presumably</span> you had setup a one-to-many relationship between two CPTs; Properties and Rentals. However when editing a Property record you cannot add new Rental records in the same screen.</li>
<li>Each CPT can only have one meta box named More Fields containing all the custom fields.</li>
<li>You cannot make basic fields like plain text repeatable which could be handy in certain scenarios. Fortunately multiple image uploads is still possible.</li>
</ol>
<h2>WordPress Types plugin</h2>
<p><div class="full"><a href="https://wordpress.org/plugins/types/" target="_blank"><img decoding="async" class="aligncenter size-full wp-image-6489" src="https://stampede-design.com/wp-content/uploads/2015/02/banner-772x250.png" alt="Types WordPress plugin" /></a></div></p>
<p>The Types plugin may not look as straightforward to use at first glance primarily because the CPT and custom fields are managed in different admin screens but once you get your head around this it actually opens up a new possibility of the things you can do.</p>
<p>These are the main strengths of Types:</p>
<ol>
<li>You can create true parent-child (or one-to-many) relationships between any CPTs or WP&#8217;s native objects with very seamless integration. For instance, in a property rental website <span data-dobid="hdw">presumably</span> you had setup a one-to-many relationship between two CPTs; Properties and Rentals. When editing a Property record you can quick-add new Rental records in the same screen. Additionally, you can also specify which fields should appear in the quick add form.</li>
<li>You can have as many meta boxes with custom headings and combination of custom fields in each CPT. Furthermore, the meta boxes support custom CSS so you can arrange certain fields in side-by-side fashion instead of one per row for instance. This creates a more intuitive editing experience for the end users.</li>
<li>All custom fields can be made repeatable.</li>
<li>Non-repeatable custom fields can be fine-tuned with conditional logic to control when they should appear based on the values of other fields.</li>
<li>Meta boxes and custom fields can be added to user profiles.</li>
<li>The equivalence of Pods Templates for Types is called Views. It is not free but certainly a lot more powerful.</li>
</ol>
<p>The limitation of Types based on my experience are:</p>
<ol>
<li>User interface can be a bit tricky to work with.</li>
<li>No custom field of type Relationship.</li>
<li>No way of adding custom fields to custom taxonomies.</li>
</ol>
<h2>Bonus: Advanced Custom Fields plugin</h2>
<p>In cases where I was using Types and needed to use the Relationship-type custom field, I usually resorted to the <a href="https://wordpress.org/plugins/advanced-custom-fields/" target="_blank">Advanced Custom Fields plugin</a>. It may sound like an overkill to use it solely for one purpose but the field provided by Advanced Custom Fields simply has the <a href="http://www.advancedcustomfields.com/resources/relationship/" target="_blank">perfect UI for a relationship-type field</a>. It is also far superior than what Pods provided by default.</p>
<p><div class="full"><img decoding="async" class="size-full wp-image-6495" src="https://stampede-design.com/wp-content/uploads/2015/02/relationship_input.jpg" alt="The perfect UI for a relationship-type field." /><p class="capt_block">The perfect UI for a relationship-type field.</p></div></p>
<p>As a matter fact, Advanced Custom Fields is by far the best custom fields plugin for WordPress. To unlock its full potential you need to purchase the Pro version though.</p>
<h2>Bonus: Codepress Admin Columns plugin</h2>
<p>When you are working with CPTs, the <a href="https://wordpress.org/plugins/codepress-admin-columns/" target="_blank">Codepress Admin Columns</a> plugin is quite simply the icing of the cake for all your hard work. The plugin allows you to customize table columns in the admin landing page of CPTs or any WP&#8217;s native objects. It fulfills a basic need that greatly enhances user experience when working with CPTs in the admin area.</p>
<p><div class="full"><img decoding="async" class="size-full wp-image-6498" src="https://stampede-design.com/wp-content/uploads/2015/02/admin-columns-demo.jpg" alt="WP Admin Columns demo" /><p class="capt_block">Custom table columns FTW!</p></div></p>
<p>Though this plugin has a Pro version, the free one is awesome enough in most cases.</p>
<h2>Conclusion</h2>
<p><a href="https://wordpress.org/plugins/pods/" target="_blank">Pods</a> and <a href="https://wordpress.org/plugins/types/" target="_blank">Types</a> are my two favorite custom post types solutions for WordPress. How I decide between them depends ultimately on individual project requirements but so far I tend to choose Types for complex projects that require post relationship. With a couple of amazing supporting plugins, you&#8217;ll be having a blast working with either anyway.</p>
<p>Have a nice day!</p>
<h3>Update (June 2015)</h3>
<p>For an in-depth look at the features and technical differences between popular WordPress CPT plugins, view this <a href="https://docs.google.com/a/stampede-design.com/spreadsheet/ccc?key=0AoY8IFUX301qdFhBaERLUEUwa3U0YjFYTnBmaU1mbmc#gid=3" target="_blank">awesome comparison matrix spreadsheet</a> by Scott Kingsley Clark and Matt Gibbs.</p>
<p>The post <a href="https://stampede-design.com/blog/wordpress-cpt-solutions-comparison-pods-vs-types/">WordPress CPT Solutions Comparison: Pods vs Types</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stampede-design.com/blog/wordpress-cpt-solutions-comparison-pods-vs-types/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>Graphene—The Road to Million Downloads: An Interview with Syahir Hakim</title>
		<link>https://stampede-design.com/blog/syahir-hakim-interviewed/</link>
					<comments>https://stampede-design.com/blog/syahir-hakim-interviewed/#respond</comments>
		
		<dc:creator><![CDATA[Zana Fauzi]]></dc:creator>
		<pubDate>Fri, 22 Jun 2012 19:17:35 +0000</pubDate>
				<category><![CDATA[Conversations]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[developer story]]></category>
		<category><![CDATA[Graphene app]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://stampede-design.com/blog/?p=2212</guid>

					<description><![CDATA[<p>Syahir Hakim is the developer behind the wildly popular and free wordpress theme - Graphene. The theme recently surpassed half a million downloads and Syahir gave an interview on Graphene's early days and how the only computer class he had taken was a quick 2-hour tutorial by Shaza.</p>
<p>The post <a href="https://stampede-design.com/blog/syahir-hakim-interviewed/">Graphene—The Road to Million Downloads: An Interview with Syahir Hakim</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>If you are a WordPress user looking for a very powerful yet flexible theme that works equally as well as for a blog as it does a full fledged website, you might want to have a try using the <a href="http://wordpress.org/extend/themes/graphene" target="_blank">Graphene theme</a> &#8211; designed and developed by none other than our very own Syahir Hakim. You also wouldn&#8217;t believe it&#8217;s also free.</p>
<p>Syahir was also featured in <a href="http://blinkcolony.com/graphene-wordpress-theme/" target="_blank">this interview by Blink Colony</a> &#8211; where he speaks of the development and features of the Graphene theme, his experiences meddling with his first family computer and being taught on the basics of HTML and CSS by his sister Shaza (where his interests in coding spurts from there) as well as mentioning Stampede Design in the interview!</p>
<p>Syahir also runs a blog of his own, <a href="http://www.khairul-syahir.com/" target="_blank">khairul-syahir.com</a>, where he talks a lot about web development, hiking and his life in general in Auckland.</p>
<p>The post <a href="https://stampede-design.com/blog/syahir-hakim-interviewed/">Graphene—The Road to Million Downloads: An Interview with Syahir Hakim</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stampede-design.com/blog/syahir-hakim-interviewed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Supermassive Custom Template</title>
		<link>https://stampede-design.com/blog/supermassive-custom-template/</link>
					<comments>https://stampede-design.com/blog/supermassive-custom-template/#respond</comments>
		
		<dc:creator><![CDATA[Syazwan Hakim]]></dc:creator>
		<pubDate>Thu, 05 May 2011 12:31:36 +0000</pubDate>
				<category><![CDATA[Field Notes]]></category>
		<category><![CDATA[custom templates]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[theme development]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://stampede-design.com/blog/?p=1052</guid>

					<description><![CDATA[<p>Supermassive is this powerful, professional WordPress theme, dubbed in their own marketing phrase "the next generation WordPress theme". It could help you to create a great looking theme that allows you to make your own unique and abstract layouts in minutes. Syazwan gladly shares his experience working on this Supermassive custom template.</p>
<p>The post <a href="https://stampede-design.com/blog/supermassive-custom-template/">Supermassive Custom Template</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="lead">Back in December 2010, I&#8217;ve been given a task to code for a design based on the Supermassive templates. For your information, <a href="http://themeforest.net/item/supermassive-a-next-generation-wordpress-theme/132454" target="_blank">Supermassive</a> is a powerful, professional WordPress theme. In their own marketing phrase, it is &#8220;a next generation WordPress theme&#8221;.</p>
<p>
Supermassive can help you to create a great looking theme that allows you to make your own unique and abstract layouts in minutes. You can easily change the position of a particular element since the <code>&lt;div&gt;</code>s are fluid. Imagine you have two horizontal boxes, named Box Left and Box Right. You can easily make Box Right in 100% width by just removing Box Left completely.</p>
<p>
I find this task to code based on Supermassive template really puts my XHTML/CSS skills to the test. I need to optimize everything that I&#8217;ve learned about building reliable yet semantic XHTML/CSS template which works on IE6, IE7, IE8, Chrome, Opera, Firefox and Safari. Working with a custom design on an existing theme requires a different set of considerations.</p>
<p>
The first thing I needed to consider is where to do the front-end coding for the custom design. This is because we want to be able to update Supermassive template in the future when a new version is released. Therefore, I need to consider where to add my front-end codes. After some discussions, we decided to code on a Supermassive Child Theme. It&#8217;s the easiest yet very reliable way to keep the ability to update to new Supermassive version in the future. When updating Supermassive original template, it will only replace the parent theme which is the original Supermassive Theme. In this case, updating the original template won&#8217;t affect the child theme.</p>
<p>
Second thing to consider is the HTML structure. Since Supermassive uses shortcode heavily for its layout based on <code>&lt;div&gt;</code>, I can&#8217;t simply code custom HTML structure. What I need to do is to create each Supermassive element using the shortcode first. Once all elements are created, I can start styling the elements based on design without making changes on the HTML element or structure. Using this method, I can still use any Supermassive shortcode without having to worry about the styling even if the shortcode will never be used.</p>
<p>
The last thing to consider is how to make the template styled according to my custom CSS instead of the original CSS. This is the trickiest part. I need to make sure everything on the custom CSS has the highest priority, so the website will be styled according to it. We can&#8217;t simply remove the original CSS because we still need some styling from it such as the administration interface, sliding effect and JavaScript element.</p>
<p>
For me, the easiest way is to add <code>!important</code> syntax at the end of the styling, e.g. <code>div a {text-decoration:hover !important;}</code>. With that, it will have higher priority. I recommend not to define any font size on the CSS because on current version of Supermassive template, there is a specific panel to change the font size directly.
</p>
<p>
Supermassive is a great tool for WordPresser because it comes with its own JavaScript snippets which includes sliding effect, tabs, and image manipulation. It also has a very user-friendly interface for administration. I&#8217;m sure Supermassive shortcode list will come in handy for beginners.</p>
<p>The post <a href="https://stampede-design.com/blog/supermassive-custom-template/">Supermassive Custom Template</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stampede-design.com/blog/supermassive-custom-template/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sticky Post Slider in WordPress without a Plugin</title>
		<link>https://stampede-design.com/blog/sticky-post-slider-in-wordpress-without-a-plugin/</link>
					<comments>https://stampede-design.com/blog/sticky-post-slider-in-wordpress-without-a-plugin/#comments</comments>
		
		<dc:creator><![CDATA[See Guo Lin]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 09:15:09 +0000</pubDate>
				<category><![CDATA[Field Notes]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[plugin-free]]></category>
		<category><![CDATA[slider]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://stampede-design.com/blog/?p=966</guid>

					<description><![CDATA[<p>A slider gives draws the attention to the blog posts selected by the owner and allows the visitors to quickly glance through some of the best posts. It is a smart and welcomed way to promote the blog with its own posts. Many blog owners seek help from various plugins to achieve the slider for featured posts. But Guo Lin prefers to code it directly in the theme he works on, while using the existing 'Sticky Post' feature in WordPress to achieve the same effect.</p>
<p>The post <a href="https://stampede-design.com/blog/sticky-post-slider-in-wordpress-without-a-plugin/">Sticky Post Slider in WordPress without a Plugin</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Many blog owners love to have a slider for featured posts in their blog home page these days. A slider gives draws the attention to the blog posts selected by the owner and allows the visitors to quickly glance through some of the best posts. It is a smart and welcomed way to promote the blog with its own posts. Many blog owners seek help from various plugins to achieve the slider for featured posts. But I prefer to code it directly in the theme I work on, while using the existing &#8216;Sticky Post&#8217; feature in WordPress to achieve the same effect.</p>
<p>Disclaimer: This may not be the only nor the best way for anyone to achieve the same presentation, but I intend to share it as a reference for interested people.</p>
<p>There are several reasons I usually choose to use the Sticky Post feature instead of implementing another custom field or tag or category etc. First, I notice the native WordPress Sticky Post feature is not in use in most of the blogs (note: personal observation), and I think this native feature should be more well utilized.</p>
<p>Second, I think the current way presenting Sticky Posts in WordPress takes away too much attention from the worthy latest posts because Sticky Posts take up the place before the latest posts at the same content area. A separate area to display the Sticky Posts such as the post slider area is a good way to give attention to some &#8216;selected&#8217; posts while not attracting too much attention away from the latest posts.</p>
<p>Third, implementing the post slider using a tag or a category is more like a hack because tags and categories are supposed to describe the contents of the blog post. Sometimes there may be a need to present contents with a certain tag or category differently (e.g. tag templates or category templates), but the main point of using tags and categories should be to describe the blog post contents, not merely as a way to differentiate the way blog posts are presented.</p>
<p>Enough said. Let&#8217;s get into how I do it.</p>
<p>Let&#8217;s say I have these blog posts and several of them are made &#8216;Stick Posts&#8217;:<br />
<div class="full"><img decoding="async" src="https://stampede-design.com/wp-content/uploads/2018/02/1.jpg" alt="a screenshot showing a list of sample blog posts in WordPress &#039;Post&#039; administrator back-end." title="List of sample blog posts" class="alignnone size-full wp-image-970" /></div></p>
<p>In the default Twenty Ten theme, each of the Sticky Posts appears in a box in a light-blue background with a thick black top border line in the home page of the blog, in the main blog posts area above all most recent posts:<br />
<div class="full"><img decoding="async" src="https://stampede-design.com/wp-content/uploads/2018/02/2.jpg" alt="a screenshot showing a sticky post in the default Twenty Ten theme in WordPress." title="A Sticky Post in the default Twenty Ten theme in WordPress" class="alignnone size-full wp-image-972" /></div></p>
<h2>MooTools and noobSlide</h2>
<p>Since in this post, I&#8217;m going to use <a href="http://www.efectorelativo.net/laboratory/noobSlide/" target="_blank">noobSlide</a> as our content slider, we need to include MooTools JavaScript library. Go to the <code>functions.php</code> file in the template and add the following codes at the bottommost.</p>
<pre class="brush: php; html-script: true; title: ; toolbar: false; wrap-lines: true; notranslate" class="lead">
function register_custom_js() {
    wp_register_script( 'mootools', 'http://ajax.googleapis.com/ajax/libs/mootools/1.3.0/mootools-yui-compressed.js', '1.3.0' );
    wp_register_script( 'noobslide', get_bloginfo('template_directory') . '/_class.noobSlide.packed.js' , array( 'mootools' ) );
}
add_action( 'init', 'register_custom_js' );

function enqueue_noobslide() {
    if ( is_home() ) { // our slider only appear in the home page, so load the script only in home page
        wp_enqueue_script( 'noobslide' );
    }
}    
add_action( 'wp_print_scripts', 'enqueue_noobslide' );
</pre>
<h2>Post Thumbnail Support</h2>
<p>In this tutorial, I&#8217;m going to use post thumbnails in my slider. If your theme has not yet added the feature, you can add it using the following codes in your <code>functions.php</code>:</p>
<pre class="brush: php; html-script: true; title: ; toolbar: false; wrap-lines: true; notranslate">
function custom_theme_setup() {
    add_theme_support( 'post_thumbnails' );
}
add_action( 'after_setup_theme', 'custom_theme_setup' );
</pre>
<p>Also make sure your Sticky Posts has set the &#8216;Featured Image&#8217; (BTW, WordPress should standardize the use of name).</p>
<h2>Custom &#8216;Read more&#8217; Link</h2>
<p>In the default Twenty Ten theme, a custom &#8220;Read more&#8221; link is used. I&#8217;m going to change it to use my own customized &#8220;Read more&#8221; link so I can place a class for styling.<br />
I will comment out this line in the Twenty Ten <code>functions.php</code> file:</p>
<pre class="brush: php; light: true; title: ; wrap-lines: true; notranslate">
//add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
</pre>
<p>Then, I will add the following to the same file:</p>
<pre class="brush: php; html-script: true; title: ; toolbar: false; wrap-lines: true; notranslate">
function custom_excerpt_with_more( $excerpt ) {
    if ( has_excerpt() &amp;&amp; ! is_attachment() ) {
        global $post;
        return $excerpt . '&lt;p class=&quot;slider-more&quot;&gt;&lt;a href=&quot;' . get_permalink( $post-&gt;ID ) . '&quot;&gt;Continue reading&lt;/a&gt;&lt;/p&gt;';
    }
    return $excerpt;
}
add_filter( 'get_the_excerpt', 'custom_excerpt_with_more' );

function custom_excerpt_more( $more ) {
    global $post;
    return '&lt;p class=&quot;slider-more&quot;&gt;&lt;a href=&quot;' . get_permalink( $post-&gt;ID ) . '&quot;&gt;Continue reading&lt;/a&gt;&lt;/p&gt;';
}
add_filter( 'excerpt_more', 'custom_excerpt_more' );
</pre>
<p><code>custom_excerpt_with_more()</code> function is for automatic excerpts or user-specified excerpts with read-more tag. <code>custom_excerpt_more()</code> is for hand-crafted excerpts.</p>
<h2>CSS and JavaScript</h2>
<p>Then, we add the custom CSS and JavaScript codes in <code>functions.php</code> to make the theme serve them when we are in the home page where the slider will appear.</p>
<pre class="brush: php; html-script: true; title: ; toolbar: false; wrap-lines: true; notranslate">
function custom_slider_css_js() {
    if ( is_home() ) { // only in home page
?&gt;
&lt;style type=&quot;text/css&quot;&gt;
#slider{border:1px solid #ccc;width:640px;position:relative;overflow:hidden;height:213px;margin-bottom:20px;}
#mask{position:absolute;height:213px;}
.items{float:left;height:213px;width:640px;position:relative;}
.items .wp-post-image {float:left;}
.info{width:320px;float:left;font-family:Arial, Helvetica, sans-serif;}
#content .info h2{font-size:20px;font-weight:bold;color:#1c3f95;margin:10px 10px 15px 10px;}
#content .info p{font-size:11px;color:#1c3f95;line-height:16px;margin:10px;}
.info a{font-size:10px;padding:5px 7px;background:#e1e1e1;text-decoration:none;text-transform:uppercase;font-weight:bold;color:#1c3f95;}
.info a:hover{color:#ffffff;background:#1c3f95;}
#slider .handle{position:absolute;bottom:0;right:5px;line-height:10px;text-align:center;font-size:25px;font-weight:bold;}
.handle a{color:#ccc;height:20px;width:20px;display:inline-block;cursor:pointer;}
.handle .active{color:#1c3f95;}
.handle a:hover{color:#1c9f65;}
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
/*&lt;!&#x5B;CDATA&#x5B;*/
window.addEvent('domready',function(){
    var nS8 = new noobSlide({
        box: $('mask'),
        items: $$('#mask .items'),
        size: 640,
        autoPlay: true,
        interval:8000,
        handles: $$('.handle a'),
        onWalk: function(currentItem,currentHandle){
            $$(this.handles).removeClass('active');
            $$(currentHandle).addClass('active');
        }
    });
    var handle = $$('.handle a');
    handle.each(function(el,i){el.addEvent('click',nS8.walk.bind(nS8,&#x5B;i,true]));});
});
/*]]&gt;*/
&lt;/script&gt;
&lt;?php
    }
}
add_action('wp_head', 'custom_slider_css_js' );
</pre>
<h2>WordPress Theme Modification</h2>
<p>Next, go to the theme template file that display the Loop in the home page, in this case, it is the loop.php file in the Twenty Ten theme. Place the cursor right before the Loop area and we can start putting our codes for the slider.</p>
<pre class="brush: php; html-script: true; title: ; toolbar: false; wrap-lines: true; notranslate">
&lt;?php 
if ( is_home() ):
    $sticky = get_option('sticky_posts');
    $slider = new wp_query( array( 'post__in' =&gt; $sticky ) );
    ?&gt;
    &lt;?php if ($slider-&gt;have_posts()): $count = 0; ?&gt;
        &lt;div id=&quot;slider&quot;&gt;
            &lt;div id=&quot;mask&quot;&gt;
                &lt;?php while ( $slider-&gt;have_posts() ): $slider-&gt;the_post(); $count++; ?&gt;
                    &lt;div class=&quot;items&quot;&gt;
                        &lt;?php the_post_thumbnail( array( 320, 213 ) ); ?&gt;
                        &lt;div class=&quot;info&quot;&gt;
                            &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
                            &lt;?php the_excerpt(); ?&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;?php endwhile; ?&gt;
            &lt;/div&gt;
            &lt;div class=&quot;handle&quot;&gt;
                &lt;?php for ($count; $count &gt; 0; $count--): ?&gt;
                    &lt;a&gt;&amp;bull;&lt;/a&gt;
                &lt;?php endfor; ?&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;?php endif; ?&gt;
&lt;?php endif; ?&gt;
</pre>
<p>At this point of time, when you go to the home page of the blog, you will see the slider is up and running already and we are almost done:</p>
<p><div class="full"><img decoding="async" src="https://stampede-design.com/wp-content/uploads/2018/02/3.jpg" alt="a screenshot showing the content slider in the home page" title="Content Slider in the home page" class="alignnone size-full wp-image-990" /></div></p>
<p>But wait, we are not done yet. Notice the main blog posts area still have the Sticky Posts? We need to get rid of them to return the attention taken away from the latest posts. To accomplish that, we will add the following codes right after our content slider codes:</p>
<pre class="brush: php; highlight: [27,28,29,30]; html-script: true; title: ; toolbar: false; wrap-lines: true; notranslate">
&lt;?php 
if ( is_home() ):
    $sticky = get_option('sticky_posts');
    $slider = new wp_query( array( 'post__in' =&gt; $sticky ) );
    ?&gt;
    &lt;?php if ($slider-&gt;have_posts()): $count = 0; ?&gt;
        &lt;div id=&quot;slider&quot;&gt;
            &lt;div id=&quot;mask&quot;&gt;
                &lt;?php while ( $slider-&gt;have_posts() ): $slider-&gt;the_post(); $count++; ?&gt;
                    &lt;div class=&quot;items&quot;&gt;
                        &lt;?php the_post_thumbnail( array( 320, 213 ) ); ?&gt;
                        &lt;div class=&quot;info&quot;&gt;
                            &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
                            &lt;?php the_excerpt(); ?&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;?php endwhile; ?&gt;
            &lt;/div&gt;
            &lt;div class=&quot;handle&quot;&gt;
                &lt;?php for ($count; $count &gt; 0; $count--): ?&gt;
                    &lt;a&gt;&amp;bull;&lt;/a&gt;
                &lt;?php endfor; ?&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;?php endif; ?&gt;

    &lt;?php
    $args = array_merge( $wp_query-&gt;query, array( 'post__not_in' =&gt; $sticky ) );
    query_posts( $args );
    ?&gt;
	
&lt;?php endif; ?&gt;
</pre>
<h2>All Done!</h2>
<p>Now enjoy your fully functional content slider. =)<br />
<div class="full"><img decoding="async" src="https://stampede-design.com/wp-content/uploads/2018/02/4.jpg" alt="a screenshot showing the home page of a sample blog with the Sticky Posts content slider" title="Sample blog home page with Sticky Posts content slider" class="alignnone size-full wp-image-1007" /></div></p>
<p><small>Images in the sample blog courtesy of <a href="http://www.flickr.com/photos/phalinn/sets/72157606276122183/" target="_blank">phalinn</a>.</small></p>
<p>The post <a href="https://stampede-design.com/blog/sticky-post-slider-in-wordpress-without-a-plugin/">Sticky Post Slider in WordPress without a Plugin</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stampede-design.com/blog/sticky-post-slider-in-wordpress-without-a-plugin/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
		<item>
		<title>Disable HTML Auto-Formatting in WordPress</title>
		<link>https://stampede-design.com/blog/disable-html-auto-formatting-in-wordpress/</link>
					<comments>https://stampede-design.com/blog/disable-html-auto-formatting-in-wordpress/#comments</comments>
		
		<dc:creator><![CDATA[Shaiful Borhan]]></dc:creator>
		<pubDate>Wed, 08 Dec 2010 17:25:04 +0000</pubDate>
				<category><![CDATA[Field Notes]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[front-end]]></category>
		<category><![CDATA[HTML formatting]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://stampede-design.com/blog/?p=788</guid>

					<description><![CDATA[<p>The "HTML mode" in the WordPress editor doesn't really provide you with total control of the HTML being generated on the frontend. Some of the auto-formatting it does are for instance wrapping your inline elements with &#60;p&#62; and line breaks are also interpreted as &#60;p&#62;. If you're someone who likes full control over the HTML of your content in WordPress, this simple solution might interest you. Shaiful shows you how.</p>
<p>The post <a href="https://stampede-design.com/blog/disable-html-auto-formatting-in-wordpress/">Disable HTML Auto-Formatting in WordPress</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="lead">I find that the &ldquo;HTML mode&rdquo; in the WordPress editor doesn&rsquo;t really provide you with total control of the HTML being generated on the frontend.  Some of the auto-formatting it does are for instance wrapping your inline elements with a &lt;p&gt; and line breaks are also interpreted as &lt;p&gt;.</p>
<p>While this is not a bad thing at all, it is however quite cumbersome if you&rsquo;re using custom shortcodes (that generate divs) in your content creation and you&rsquo;re planning to arrange them nicely in the editor by giving a couple of line breaks for better readability. They will end up in the frontend as &lt;div&gt; wrapped inside a &lt;p&gt;, and you&#8217;ll get some unwanted &lt;br /&gt; as well. Certainly not pretty.
</p>
<p>The auto-formatting function will still run even if you disabled the visual editor entirely because it is not part of the TinyMCE editor. In fact it is performed via a function in WordPress called <a href="http://codex.wordpress.org/Function_Reference/wpautop" target="_blank">wpautop</a> that runs before the content is displayed on the frontend. Thus it is possible to bypass this feature by using the remove_filter function in our theme function.php file. The simple code for a global site-wide effect is:
</p>
<pre class="brush: php; title: ; notranslate"> 
   remove_filter('the_content', 'wpautop');
</pre>
<p>A more elegant approach would be to use a custom field to control which content will bypass wpautop and which not. This way we can still take advantage of the usefulness of the wpautop function for pages that doesn&rsquo;t require fancy HTML. The code below also goes in the function.php file.
</p>
<pre class="brush: php; title: ; notranslate">
function WP_auto_formatting($content) {
    global $post;
    if(get_post_meta($post-&gt;ID, 'disable_auto_formatting', true) == 1) {
        remove_filter('the_content', 'wpautop');
    } 
    return $content;	
}
add_filter( &quot;the_content&quot;, &quot;WP_auto_formatting&quot;, 1 );
</pre>
<p>Using this method, you simply have to add a custom field in your post/page called disable_auto_formatting and give it a value of 1 to bypass the wpautop function. To enable auto formatting, simply change the value to 0 or delete the custom field.   </p>
<p>Have a nice day! </p>
<p>The post <a href="https://stampede-design.com/blog/disable-html-auto-formatting-in-wordpress/">Disable HTML Auto-Formatting in WordPress</a> appeared first on <a href="https://stampede-design.com">Stampede: the strategic design &amp; technology company</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://stampede-design.com/blog/disable-html-auto-formatting-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
	</channel>
</rss>
