Posts Tagged “WordPress”

The Proper Way to Add CSS and JS to a WordPress Theme

Posted on June 23rd, 2014 by webninjataylor

Add this to functions.php for JS and CSS.  Check out the WordPress Codex for available parameters and info on using the ‘$’ namespace for jQuery. <?php function wnt_styles(){ // STYLES wp_register_style(‘bootstrapcss’, get_template_directory_uri() . ‘/css/bootstrap.css’, array(), ‘20140529’, ‘all’ ); wp_enqueue_style(‘bootstrapcss’); } add_action(‘wp_enqueue_scripts’, ‘wnt_styles’); wp_enqueue_script(‘jquery’); // This is all that’s needed for jQuery since WordPress already has […]

WordPress Child Themes

Posted on June 23rd, 2014 by webninjataylor

Use child themes to avoid losing changes when themes are updated by their vendors. Create a new theme folder with the same name as its parent, plus “-child” appended to it Create a style.css file with at least the following three required lines… Theme Name (ex.Theme Name: Twenty Fourteen Child) … NOTE: No spaces allowed […]

Override WordPress Tag Cloud Defaults

Posted on June 18th, 2014 by webninjataylor

Add this to functions.php… function my_widget_tag_cloud_args( $args ) { // Your extra arguments go here $args[‘number’] = 999; return $args; } add_filter( ‘widget_tag_cloud_args’, ‘my_widget_tag_cloud_args’ ); Resources Tag Cloud Defaults

Tags:
Posted in Web ShotsComments Off on Override WordPress Tag Cloud Defaults

Number of WordPress Search Results

Posted on June 18th, 2014 by webninjataylor

Control the number of search or post tag results in WordPress by adding the following just before “<?php if (have_posts()) : ?>” in search.php and/or archive.php… <?php query_posts($query_string . ‘&showposts=25’); ?> Resources WordPress Codex: Tag Templates

Tags:
Posted in Web ShotsComments Off on Number of WordPress Search Results

Custom Links in WordPress Admin Bar

Posted on June 11th, 2014 by webninjataylor

Add to the theme’s functions.php file… function admin_bar_custom_links(){ global $wp_admin_bar; if(!is_super_admin() || !is_admin_bar_showing()){ return; } $wp_admin_bar->add_menu(array( ‘id’ => ‘all_posts’, ‘title’ => __(‘All Posts’), ‘href’ => __(‘http://webninjataylor.com/library/wp-admin/edit.php’), )); // Add sub menu link $wp_admin_bar->add_menu( array( ‘parent’ => ‘all_posts’, ‘id’ => ‘all_pages’, ‘title’ => __( ‘All Pages’), ‘href’ => __(‘http://webninjataylor.com/library/wp-admin/edit.php?post_type=page’), )); } add_action(‘admin_bar_menu’,’admin_bar_custom_links’,25); Change parent, id, title, […]

Tags:
Posted in Web ShotsComments Off on Custom Links in WordPress Admin Bar

Disabling Comments on a WordPress Site

Posted on March 18th, 2013 by webninjataylor

Disable under Settings > Discussion Remove this code from page.php… <?php comments_template( ”, true ); ?>

Tags:
Posted in Web ShotsComments Off on Disabling Comments on a WordPress Site

Customize WordPress Content Editor

Posted on March 18th, 2013 by webninjataylor

Add this to your theme’s functions.php file… /******** ADD CUSTOM STYLES TO TINYMCE EDITOR ********/ add_filter(‘mce_buttons_2’, ‘my_mce_buttons_2’); function my_mce_buttons_2($buttons) { array_unshift($buttons, ‘styleselect’); return $buttons; } add_filter(‘tiny_mce_before_init’, ‘my_mce_before_init’); function my_mce_before_init($settings) { $style_formats = array( array( ‘title’ => ‘Button’, ‘selector’ => ‘a’, ‘classes’ => ‘button’ ), array( ‘title’ => ‘Callout Box’, ‘block’ => ‘div’, ‘classes’ => ‘callout’, […]

Recommended WordPress Plugins

Posted on March 18th, 2013 by webninjataylor

WordPress Backup to Dropbox (for backing up data; otherwise, use GitHub for theme files) MarketPress Akismet Form Manager NextGEN Gallery NextGEN Galleryview ShareThis P3 – Plugin Performance Profiler: Analyzes how fast your page loads and which plugins are slowest

WordPress Theme Basics

Posted on March 18th, 2013 by webninjataylor

Installing online (via admin interface browsing to a zip file) is the same as uploading the unzipped theme directly Theme files can be edited directly within the admin interface style.css holds all the meta info the site needs functions.php is the heart of the theme Link to theme images using PHP to keep everything relative […]