Categories

A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

10 Most Used Web Development Tools

Strong Password Generator strongpasswordgenerator.com

Advanced CSS topics alistapart.com

Rounded Corners border-radius.com

Image Placeholders placehold.it

Favicon Generators www.favicon.cc

Gradient Generator www.colorzilla.com/gradient-editor

Color Picker www.colorpicker.com

Color themes kuler.adobe.com/create/color-wheel

Free icons raphaeljs.com/icons

CSS Shadows www.cssmatic.com/box-shadow

WordPress misses Publishing Schedule

I haven’t figured out why WordPress is missing schedule post, but I wrote a script that is ran with crontab that notifies me when it happens.

<?php include 'wp-load.php'; $total_missed_schedules = 0; $blogs = crontab_get_blogs(); $output = ''; foreach($blogs as $blog) { $blog_prefix = $wpdb->get_blog_prefix( $blog->blog_id ); $results = query_missed_schedules( $blog_prefix ); $total_missed_schedules += count($results); […]

How to Add CSS Styles to WordPress Breadcrumbs

functions.php

function get_page_parents( $id=0, $separator="/" ){ $itisme=get_post($id); $lineage = '<span>'.$itisme->post_title.'</span>'; $parentID=$itisme->post_parent; while( $parentID != 0 ){ $parent=get_post($parentID); $lineage='<a href="' . get_permalink($parent->ID) . '">' . $parent->post_title . '</a>'.$separator.$lineage; $parentID=$parent->post_parent; } return $lineage; } include 'includes/breadcrumb-styles.php'; add_action('wp_head', 'add_breadcrumb_styles');

page.php

<?php get_template_part( 'nav', 'above-page' ); ?>

nav-above-page.php

<div id="page-bread-crumbs"> <a class="home" href="/">Home</a> &gt; <?php echo get_page_parents( $post->ID, " […]

WordPress custom menu link target _blank

Problem

In WordPress at least for custom links, it would be great to allow menu options to open in a new window/tab via the target=”_blank” element in the link tags. Controlling menus in the WP Menu tool is awesome, but many of the sites I work with have external links in the main navigation menus […]

Display login or register links

Display login or register link

<?php if(is_user_logged_in()):?> <?php else: // not logged in ?> <?php wp_die('Sorry, you must first '. wp_loginout( get_permalink() ).' to view this page. You can '.wp_register( '', '').'.'); ?> <?php endif; // logged in? ?>

Flush wp_rewrite rules

As stated on WordPress Codex: Flushing the rewrite rules is an expensive operation. So it’s best to refresh your wp_rewrite rules by not using the init hook. Austin Passy chooses to Flush your rewrite rules on plugin/theme activation on checking $_GET parameters. I’ve tried it two different ways. The first option seemed to work for […]

Custom Post Type redirects to 404 page

This function from dev4press really helped me debug my custom post type redirect to a 404 page.

 

Place this code in your functions.php file:

function dev4press_debug_page_request() { global $wp, $template; echo '<pre>!– Request: '; echo empty($wp->request) ? "None" : esc_html($wp->request); echo ' –>'.PHP_EOL; echo '!– Matched Rewrite Rule: '; echo empty($wp->matched_rule) ? None : […]

Breadcrumbs for Taxonomy for a Custom Post type

This is what I came up with to display the category, or rather a custom taxonomy, of a single posttype page of use in a breadcrumb. The taxonomy I used is ‘smg-logo-brand’ and the terms slug where ‘kcrg’, ‘the-gazette’ and ‘sourcemedia.’ I compared the terms associated with the post to that in the URL to […]

Custom post type capabilities

$custom_posts_caps = array('edit_custom_post', 'read_custom_post', 'delete_custom_post', 'edit_custom_posts', 'edit_others_custom_posts', 'publish_custom_posts', 'read_private_custom_posts'); _smg_add_cap('administrator', $custom_posts_caps); _smg_add_cap('editor', $custom_posts_caps); 'capabilities' => array( 'edit_post' => 'edit_custom_post', 'read_post' => 'read_custom_post', 'delete_post' => 'delete_custom_post', 'edit_posts' => 'edit_custom_posts', 'edit_others_posts' => 'edit_others_custom_posts', 'publish_posts' => 'publish_custom_posts', 'read_private_posts' => 'read_private_custom_posts' ),

Create and verify a nonce

All of this is created in a class

// place this in __construct of the class $this->nonce_name = 'name_' . $my_post_type_slug; $this->nonce_action = 'saving_posttype_' . $my_post_type_slug; add_action('save_post', 'save_my_custom_posttype', 10); // place this in a meta box echo ' '; // your custom save w/ nonce function save_my_custom_posttype($post_id) { if (isset($_POST[ $this->nonce_name ]) && wp_verify_nonce( $_POST[ […]