Code Food Travel repeat!

WordPress Tips, Tricks, & Customizing for Admins

I want to share my tips for the best WordPress setup for your own or a client’s website. So let’s dive in!

WordPress Jetpack

  1. Install WordPress JetPack. FIX below for ICDSoft webhost customers (for whom Jetpack is blocked out of the box):
    1. Problem: Error message: ‘site_inaccessible – Error Details: The Jetpack server was unable to communicate with your site [HTTP 412].’
      1. Explanation from ICDSoft Tech Support: We have a special set of rules on the server that are employed to prevent most popular hacking attempts. The xmlrpc.php module of WordPress very often is a target of hack attacks, that’s why we have a rule that disables the access to it. Please add the following code to the .htaccess file in the WordPress directory of the account:
    2. Solution: Go to control panel, click file manager, go to wordpress install directory, open .htaccess file to edit.
    3. Change security setting to let JetPack talk to WordPress.com by pasting the below code into .htaccess. Click save, and it will work! You may have to redo .htaccess edit on wordpress upgrades etc, not sure.
      Code for 2015 (updated):

      <IfModule security2_module>
      SecRuleRemoveById 114
      </IfModule>
      

An Administrator’s Guide to Customizing WordPress

  • WordPress Editor with TEMPLATED LAYOUTS for your non-techy clients to add info to complex layouts: http://wp.smashingmagazine.com/2011/10/14/advanced-layout-templates-in-wordpress-content-editor/
  • Adding Scripts to WordPress: rollyourowncreative.com/2011/09/adding-scripts-to-wordpress-the-right-way/
  • wordpress.org/extend/plugins/social-media-mashup/
  • Add Automated WordPress MENU support for your older theme http://www.devlounge.net/code/how-to-add-support-for-menus-in-your-wordpress-theme
  • Enabling Support for Featured Post Thumbnails http://codex.wordpress.org/Post_Thumbnails
  • WP Invoicing System http://wordpress.org/extend/plugins/wp-invoice/

Administration

Building a Microsite within WordPress

Migrating WordPress

Custom Layouts by working with “Content Templates”!

Custom Post Types

Ajax category Reorganize

Custom Taxonomies (Categories / Tags) & Custom Fields for the Custom Taxonomies

To use Custom fields, all you need to do is create them and fill its data in term page. Now when you have added the taxonomy to your post then you can display it using the shortcode [xy_{name_of_taxonomy}] or [xy_{name_of_taxonomy} field=”{field_name}”] as you want.

For Example if you created Taxonomy named “BOOK”

with Custom Fields “AUTHOR”

then you can access the data by using [xy_book] or [xy_book field=”author”]

Yes, you can use the shortcode to acces the values, and to add it to theme you can use the following code:

1 echo do_shortcode('[{short-code-name}]');
2 such as :
3 echo do_shortcode('[xy_project]');

 

 

Ordering Taxonomies / Categories / Tags

Images

&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;!--?php $content = $post---&amp;amp;amp;amp;amp;amp;amp;gt;post_content;&lt;br&gt;<br>
$searchimages = '~&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;img alt="" /&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;]* /&amp;amp;amp;amp;amp;amp;amp;gt;~';&lt;/p&gt;<br>
&lt;p&gt;/*Run preg_match_all to grab all the images and save the results in $pics*/&lt;/p&gt;<br>
&lt;p&gt;preg_match_all( $searchimages, $content, $pics );&lt;/p&gt;<br>
&lt;p&gt;// Check to see if we have at least 1 image&lt;br&gt;<br>
$iNumberOfPics = count($pics[0]);&lt;/p&gt;<br>
&lt;p&gt;if ( $iNumberOfPics &amp;amp;amp;amp;amp;amp;amp;gt; 0 ) {&lt;br&gt;<br>
// Your post have one or more images.&lt;br&gt;<br>
}&lt;/p&gt;<br>
&lt;p&gt;?&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>

Display an image gallery automatically if it has one, else ignore: source: wordpress.org/support/topic/how-to-know-if-the-post-has-attachment

&lt;br&gt;<br>
/* Function to show the post gallery just if it exists */&lt;br&gt;<br>
function show_gallery( $post_id ) {&lt;br&gt;<br>
$args = array(&lt;br&gt;<br>
'post_type' =&amp;amp;amp;amp;amp;amp;amp;gt; 'attachment',&lt;br&gt;<br>
'numberposts' =&amp;amp;amp;amp;amp;amp;amp;gt; null,&lt;br&gt;<br>
'post_status' =&amp;amp;amp;amp;amp;amp;amp;gt; null,&lt;br&gt;<br>
'post_parent' =&amp;amp;amp;amp;amp;amp;amp;gt; $post_id&lt;br&gt;<br>
);&lt;br&gt;<br>
$attachments = get_posts( $args );&lt;br&gt;<br>
$is_images = false;&lt;br&gt;<br>
// make sure the attachment(s) are image(s). otherwise, ignore them&lt;br&gt;<br>
foreach( $attachments as $item ) {&lt;br&gt;<br>
$mime_types = explode( "/", get_post_mime_type( $item-&amp;amp;amp;amp;amp;amp;amp;gt;ID ) );&lt;br&gt;<br>
if ( in_array( 'image', $mime_types ) ) {&lt;br&gt;<br>
$is_images = true;&lt;br&gt;<br>
break;&lt;br&gt;<br>
}&lt;br&gt;<br>
}&lt;/p&gt;<br>
&lt;p&gt;if ( $is_images )&lt;br&gt;<br>
echo do_shortcode( '&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;amp;lt;/pre&amp;amp;amp;amp;amp;amp;amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/pre&amp;gt;&lt;br&gt;<br>





&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;lt;pre&amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;&lt;br&gt;<br>
&amp;amp;amp;amp;amp;amp;amp;lt;pre&amp;amp;amp;amp;amp;amp;amp;gt;' );&lt;br&gt;<br>
else&lt;br&gt;<br>
echo '&lt;/p&gt;<br>
&lt;p&gt;' . __( 'Sorry, no photos for this item.' ) . '&lt;/p&gt;<br>
&lt;p&gt;';&lt;br&gt;<br>
}&lt;br&gt;<br>

Video

TIPS

Don’t use $ if adding your own JQuery to WordPress

, it will probably break. For ex: replace

$("#gallery")

with

jQuery("#gallery")

According to this post, WordPress reserves $ for Prototype.

Reduce your bounce rate with the NYTimes Read More / Next Article Flyout Callout box

wordpress.org/extend/plugins/upprev-nytimes-style-next-post-jquery-animated-fly-in-button/

Ajax

WordPress Keyboard Shorcuts

      • Bold: Alt+SHIFT+b
      • Italics: Alt+SHIFT+i
      • Link: Alt+SHIFT+a
      • Blockquote: Alt+SHIFT+q
      • Code: Alt+SHIFT+c
      • Read More: Alt+SHIFT+t
      • Unordered List (ul): Alt+SHIFT+u
      • Ordered List (ol): Alt+SHIFT+o
      • List Item (li): Alt+SHIFT+l
      • Advanced Editor: Alt+SHIFT+v
      • Publish the Post: Alt+SHIFT+p
      • ins: Alt+SHIFT+s
      • del: Alt+SHIFT+d
      • Unquote/outdent: Alt+SHIFT+w
      • Undo: Alt+SHIFT+u
      • Redo: Alt+SHIFT+y
      • Edit HTML: Alt+SHIFT+e
      • Align Left: Alt+SHIFT+f
      • Align Center: Alt+SHIFT+c
      • Align Right: Alt+SHIFT+r
      • Headers: Ctrl+[number] to get various header sizes on highlighted text

Popular Posts by Category

wordpress.org/extend/plugins/wordpress-popular-posts/installation/

robmalon.com/most-popular-pages-by-category-dynamic-wordpress-hack/

About Steven Chu


Hi, I'm Steven! I'm an entrepreneur, photographer and art director in New York. Follow this blog for self expression, fun, and most importantly: looking comfortable, at ease, and amazing in your photos no matter who takes them! I dedicate this to my amazing friends who have let me inadvertently turn all of our hangouts and travel photos into a never ending photoshoot of fun. The proof is in the pudding-- our photos rock. My other projects: I'm the founder of InstaTechie.com, a face-to-face tech concierge service for NYC. Book a techie to walk you through something you want to learn! My work focuses on socially engaged art projects which use technology to create access to resources for communities. Visit Steven Chu Studio (stevenchustudio.com) for branding & design work or Steven Chu (stevenchu.com) for photography projects.

Leave a Reply

%d bloggers like this:
Read previous post:
automated_menu_divider_lines
CSS Tricks – Automated Divider Lines on your Nav Menu + Image Grid spacing w/ :first & :nth-child

The Orphan Divider Problem If you've been wondering how to put divider lines in your menu, and have been getting...

Close