Function Suddenly Stopped Working

Here is your problem: “options” => array(“Next/Previous Links”, “Pagination”), “std” => “Next” Your valid options don’t match your default. Change this: “std” => “Next” …to this: “std” => “Next/Previous Links” Then, in your function call, change this: if( get_option( $shortname . ‘_next_prev_or_paginate’ ) == ‘Next’ ) …to this: if( get_option( $shortname . ‘_next_prev_or_paginate’ ) == … Read more

Featured Image keeps cropping

add_action( ‘wp_enqueue_scripts’, ‘brian_scripts’ ); if ( function_exists( ‘add_theme_support’ ) ) { add_theme_support( ‘post-thumbnails’ ); set_post_thumbnail_size( 214, 9999, false ); add_image_size(‘large’, 500, 9999, true); //custom size } This code is in your functions.php? The docs for add_theme_support() suggest to only use it in the functions.php of the theme or attach it to the after_setup_theme hook. Also … Read more

Overwriting TwentyTwelve template file with child theme template, but lower in the hierarchy

This is minimally tested– nearly untested really– but: function force_archive_php_wpse_88824() { if (is_main_query() && is_archive()) { include (get_stylesheet_directory().’/archive.php’); exit; } } add_action(‘template_redirect’,’force_archive_php_wpse_88824′); You are interrupting the template load process and forcing a file of your choice to be used. Reference http://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect http://codex.wordpress.org/Function_Reference/get_stylesheet_directory

How to setup a popup registeration page in wordpress with function.php

You can add the HTML for the area via wp_footer, include the style with wp_enqueue_style(), and include the javascript to show/hide the popup with wp_enqueue_script(). wpse90382_popup_function() { add_action( ‘wp_footer’, ‘wpse90382_popup_html’ ); wp_enqueue_style( ‘your_style’, get_template_directory_uri() . ‘your_stylesheet.css’ ); wp_enqueue_script( ‘your_script’, get_template_directory_uri() . ‘your_javascript.js’ ); } wpse90382_popup_html() { ?> <div>Your HTML</div> <?php } if ( some condition … Read more

Adding tables to the WordPress Editor

updated with more explanation If you want to build this into your theme – this tutorial for adding some code to functions.php will work. Keep in mind you will have to download TinyMCE and add files to /wp-includes for this to work. That’s because “table management” is a plugin for TinyMCE and doesn’t ship with … Read more

file.php not loaded?

OK, so there’s a bunch of admin functions in wp-admin/includes. These are loaded at some point between the loading of the theme’s functions.php and the admin_init hook. But that are ONLY loaded for admin-side pages. They are not loaded for front-end pages or AJAX calls. If you want to use these functions in front-end pages … Read more

define css class in functions.php

First off, the origin of the data (WordPress theme options) aside, this question is pretty much about generic PHP and CSS. That being said, here’s how: PHP Stylesheet Add a new file to your theme, call it “dynamic_styles.php” or the like. Note that while it will contain mostly CSS, you give it a .php file … Read more

Enqueueing scripts selectively & activation where needed

If you’re only enqueueing scripts when they’re needed, you can check in JS if the plugin’s namespace exists before trying to use it: if( $.fn.slider ) { $(‘#slider’).slider(); } or another option is to pass some script vars via wp_localize_script: $wpa_script_data = array( ‘is_front_page’ => is_front_page(), ‘slider_options’ => array( ‘speed’ => 6000 ) ); wp_localize_script( … Read more