Tag Info

Hot answers tagged

7

Modify a registered style's path I wanted to tweak the path to one of the WordPress admin stylesheets so i could keep requests down, and because it makes little sense to include two stylesheets, when the one i'm calling redefines all the styling in the stylesheet enqueued by WordPress. The idea is basically to re-point the existing style at a different ...


7

Theme stylesheets aren't usually enqueued, they're normally loaded using.. <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> So naturally you don't see them(it) in the styles array.. You can of course(if you prefer) use an enqueue instead.


5

Technically speaking, there is no "standard" Post Format. Rather, "standard" is simply the default - as in, no Post Format type is defined. If no Post Format type is defined, get_post_format() simply returns null. I would suggest re-factoring your code above, and re-naming your icon images using the exact Post Format string. That way, you could do: ...


5

The background is a option. You can set colors and also images. See in the Administration area, Appearance --> Background Also you can use the Live Preview link on the theme and customize the background and other otpions.


3

When your users really need 30 lines of custom CSS, your theme is flawed. Create a set of predefined styles instead (dark and light scheme, sans and serif fonts etc.) and prepare your main stylesheet for these cases. You can hook into body_class then and add the classes you need to get these styles. Adjustments for your users should be very minimal then. ...


3

There are many plugins for that mostly based on shortcodes i use either Google Syntax Highlighter for WordPress http://wordpress.org/extend/plugins/google-syntax-highlighter/ SyntaxHighlighter Evolved http://wordpress.org/extend/plugins/syntaxhighlighter/


3

You can change the order of the scripts but can't have one script load before anything else. The HTML 5 enabling script is IE conditional so you probably don't want to use wp_enqueue_script as it would load for all browser users which isn't necessary. It's ok to hard code it in your themes header. Even Twentyeleven does it this way. Also there is nothing ...


3

I would put all the common css in the theme's style.css, and create separate stylesheets for the color options. I would also put color options in their own folder with the images for that style. This way you can keep the filenames the same between color options to make maintaining the code a little easier. If you wanted to separate common.css from ...


3

Method 2 You can enqueue all of your stylesheets form the same place even controlling where the stylesheets load by means of template conditionals, which is convenient and prevents a lot of mess in your <head>. You can remove enqueued stylesheets if you need to via a plugin, for example. Enqueued stylesheets are child theme friendly as they can be ...


2

In short: make sure that the Jetpack plugin is installed and enabled, and also that the Jetpack Lite plugin is not enabled. I found out that Edit CSS is provided not by WordPress itself but by the plugin Jetpack. Jetpack was still installed; I had a Jetpack menu right below Dashboard. But when I opened it, I saw only two items, “WordPress.com Stats” and ...


2

using: http://codex.wordpress.org/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_Behavior and the $strip_teaser parameter: http://codex.wordpress.org/Function_Reference/the_content#Usage in single.php, replace <?php the_content(); ?> with: <?php if( strpos(get_the_content(), '<span id="more-') ) : ?> <div ...


2

put wp_enqueue_script() in your shortcode handler. add_shortcode('myshortcode', 'my_shortcode_handler'); function my_shortcode_handler($atts) { wp_enqueue_script('my-script', plugins_url('my-script.js', __FILE__), array('jquery'), '1.0', true); // actual shortcode handling here return "bacon flavored shortcode here"; } this definitely loads the ...


2

You can use the filter wp_admin_css_uri in the function of the same name which returns the uri of the admin css files. E.g.: function custom_modify_styles( $_file, $file ) { if( 'style' == $file ) // $file = css filename without extension $_file = 'my/new/path/to/style.css'; return $_file; } add_action( 'wp_admin_css_uri', ...


2

First of all Check If you disabled the visual editor from your profile page. [See the Screen Shot] You ned to uncheck the box - Visual Editor, the option is located in User's Edit Profile Page. UPDATE - 1 2 - You might have been disabled the Kitchen Sink, To enable it Click on small button available in visual editor (Right most button) icon or Press - ...


2

If it's purely for setting the style of the text you may want to use JavaScript/jQuery instead. Here's a quick sample that would replace all instances of "ipsum" with <span class="red">ipsum</span> And the full code: // Find text in descendents of an element, in reverse document order // pattern must be a regexp with global flag // function ...


2

When you register a plugin option page you get a hook from the registration function: $hook = add_menu_page( 'T5 Demo', // page title 'T5 Demo', // menu title 'manage_options', // capability 't5-demo', // menu slug 'my_render_page' // callback function ); Use this hook to enqueue the scripts and styles: ...


2

The CSS comes from wp-includes/css/buttons.css. Do not change this this file; it will be overridden during the next update. Create a separate plugin instead, or add some custom code to your theme’s functions.php, and hook into login_head: add_action( 'login_head', function() { ?> <style> .button { background: red !important; } ...


2

If your theme uses wp post class function post_classes($classes) { global $post; $customMetaVariable = get_post_meta( $post->ID, 'customMetaName', true ); if($customMetaVariable == 'desiredCustomMetaValue'){ $classes[] = 'cssClassName'; return $classes; } } add_filter('post_class', 'post_classes'); then in your ...


1

After some Googling, I found a solution that was originally done for a Twitter embed, but I modified it to work with all oEmbed contents. Keep in mind that for this to work on existing posts, you'll need to do an "update" for the oEmbed content to refresh from the cache. add_filter('oembed_result','center_oembed',10,3); function center_oembed($html, $url, ...


1

G.M.'s advice not withstanding, bear in mind that there is no foolproof way of isolating your table from the theme. CSS selectors with more specificity, or with rules that you haven't accounted for, or with !important rules, will always take precedence. This is actually correct behaviour, as websites should be able to style elements (including your plugin's ...


1

The recomendation is always register and enqueue scripts and styles. A lot of problems will be avoid, mainly duplicate files, diferent versions of the same script being loaded, etc. Anyway, in the case of using your very own custom css file used only in the header.php of your theme is quite rare that you get problems by not enqueue it But it is safer if you ...


1

If you want the stylesheets registered in the backend, use the admin_enqueue_scripts action. function wp94156_register_styles() { wp_register_style( 'your-stylesheet', get_stylesheet_directory_uri() . '/your-stylesheet.css', $deps, // optional $version // optional ); // since you only want it registered, we won't ...


1

You should be using post_class (and body_class for that matter) but you don't need it for this. Alter your Loop on your home page to conditionally format the first post. $first = (!is_paged()) ? true : false; if (have_posts()) { while (have_posts()) { the_post(); if ($first) { // code to format the first post $first = false; } else ...


1

It's actually very simple: Use the $wp_query object property current_post. You have to note that it's starting the index with 0, so I'm counting up by one in the example below. if ( have_posts() ) { while( have_posts() ) { the_post(); ?> <article <?php post_class( "post-nr-{$GLOBALS['wp_query']->current_post+1}" ...


1

You can use Open Graph Protocol to define the data Facebook fetches from your site: http://developers.facebook.com/docs/opengraphprotocol/ The metatag for the description has this form: <meta property="og:description" content="my custom description for single post" /> You can use plugins, like ...


1

Using Open Graph should solve this for you. When you use Open Graph, you are essentially telling the social networks what Title, Description, Image, etc to use. I use WordPress SEO by Yoast, and it works wonders because you can also include the extra Open Graph tags needed for Twitter cards. I hope that helps.


1

The metabox div gets an ID of 'meta_' + your metabox ID, thus: Sorry, that was me looking at my own metaboxes, forgetting that I actually prefix them like that to differentiate the container from elements within the container :( Let's work through your code and see if we can find the answer. First, your metabox has the id 'wpptabs_company_details', so the ...


1

I din't try it, but have a try yourself: Contact Form 7 uses something like this: <p>Your Name (required)<br /> [text* your-name] </p> Instead of using paragraph tag (<p>) use span (<span>), and some inline CSS, like: <span style="width: 48%; float: left; position: relative;">Your Name (required)<br /> ...


1

You could use the wp_head hook and inject your <style> tag directly into the <head>. Note: make sure you're firing the wp_head() function in your template (which you should be doing already). add_action('wp_head', 'random_background_image_wpse_83275'); function random_background_image_wpse_83275() { $images = array( '/path/to/image1.jpg', ...


1

The issue in your first block of code is syntax: if( get_post_type() == ( 'activity' OR 'dining' OR 'heritage' OR 'hiking' OR 'nightlife' ) ) : this isn't proper use of OR and will evaluate true regardless of what get_post_type() returns. The issue in your second block is again syntax, you have to break; at the end of every switch case or the other ...



Only top voted, non community-wiki answers of a minimum length are eligible