Tag Info

New answers tagged

0

Use get_ancestors to get the page parent, then check against that value instead of checking against the name. $ancestors = array(); $ancestors = get_ancestors($post->ID,'page'); $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID; if (!empty($parent)) { switch ($parent){ case 1 : // menu for parent page ID 1 break; ...


1

It is possible to change the output of the menu, by creating a new menu Walker. I wouldn't recommend this solution, however, since you're attempting to do something that's actually invalid HTML - the ul tag should only have li tags inside it, never anything else. I know it's possible to create the solution you're looking for with css and javascript, as I've ...


0

You can use a Custom Walker to add attributes to the menu items. Basically, you add a parameter 'walker' to the wp_nav_menu() options and call an instance of an enhanced class: wp_nav_menu( array ( 'menu' => 'main-menu', 'container' => FALSE, 'container_id' => FALSE, 'menu_class' => ...


0

function myButton($atts, $content = ''){ extract(shortcode_atts(array( 'text' => '', 'link' => '' ), $atts)); $html = '<a href="' . $link . '"><div class="myButton">' . $text . '</div></a>'; return $html; } add_shortcode('mybutton', 'myButton'); Add this to your functions.php and you ...


0

The example in the page you linked uses get_template_directory_uri(), which will only give you the parent theme URI. If you want to target something in a child theme, you have to swap that for get_stylesheet_directory_uri(), which will give you the child theme URI, in the event a child theme is being used.


1

How to load a custom stylesheet for your Front Page Set up front-page.php (which you've done already). Create a stylesheet for your front page (you can copy style.css, but more likely, you'll just want to override a few things). Let's call it front-page-style.css. View the HTML source of one of your pages, and find the id of the style.css file (probably ...


1

You can simply use body_class(). <body <?php body_class( is_page( 'about' ) ? 'special-class' : '' ); ?>>


1

You can do this by modifying your theme's CSS, which you can get to at Appearance > Editor in the Dashboard. You will need to style the widget list element by dropping this in your theme's style.css .widget.latest-tweets .widget-wrap ul { list-style: none; list-style-image: url(http://your-image-url-here); } Edit: Updated code to relevant to ...


0

It is very hard to tell what is being asked but... The parent stylesheet should not be included by default. The child theme’s stylesheet will overwrite the parent theme’s stylesheet http://codex.wordpress.org/Child_Themes Your theme is doing something odd to include its stylesheet, like registering and enqueueing it, or your child theme is ...


0

You could avoid using @import in your child theme CSS so your child theme would not use parent's styles at all. You could also use !importantin your CSS rules to override parent's CSS rules.


1

Since the text that displays your navigation is made out of anchor points, which has the color: #333333; assigned, you'll have to add the .current-menu-item color to the anchor itself: #header nav .current-menu-item a { color: #c6e000; }


1

Register/enqueue an admin stylesheet function my_admin_theme_style() { wp_enqueue_style('my-admin-theme', get_template_directory_uri().'/admin-style.css'); } add_action('admin_enqueue_scripts', 'my_admin_theme_style'); Then add rules of the form #widget-list div[id*="_archives-"], div[id*="_archives-"] { background:red; } Consider that proof of ...


0

First, make sure you make your edits in the Theme's style.css not the core. To make your elements 100% you can simply apply a width: 100% to them.


0

This assumes that you want to add a background image for a specific page: Create your CSS class for the background you want. body.custombg {background: url("images/background.gif"); } In the header, you can use something like this to check for a specific page. <body <?php if(is_page(123)) echo 'class="custombg"' ?>> See Conditional Tags ...


0

Pure CSS, works for me. This will work with submenus also ul.nav>li:last-of-type a


0

try it this is css problem .blogcontent class div should be inside endwhile. <section> <?php $the_query = new WP_Query( array( 'category_name' => 'news,reviews', 'posts_per_page' => 50 ) ); while ($the_query->have_posts()) : $the_query->the_post(); ?> <div class="thumbnailwrap"> <?php the_post_thumbnail (array(150,150)); ...


1

one solution to your problem using jQuery( put this code in functions.php ) <?php add_action('wp_footer','ravs_browse_menu'); function ravs_browse_menu(){ if(isset($_GET['cat']) && $_GET['cat'] !=''){ ?> <script> jQuery(document).ready(function(){ jQuery('#menu-item-299').addClass('current-menu-item'); }); </script> ...


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; } ...


0

The markup on the two sites is different. The main site, using your labels, has a body_class of left-sidebar, the network site as a body_class of right-sidebar. I'd call this a pure CSS/markup issue except that you are dealing with body_class so either there is a theme setting that did not transfer or something has been altered in a template file or a ...


0

Eleven40 does not contain these styles in the style sheet. Paste all the styles listed on the tutorial page just above this line (in the child theme style.css file): /* Inner ------------------------------------------------------------ */ Follow the other steps specified in the tutorial and you are set.


1

The code you posted will only make difference in adding <div class="first-post"></div> for the first post, so it still displays same information for all posts. Try this instead: <?php $queryObject = new Wp_Query( array( 'showposts' => 5, 'post_type' => array('post'), 'category_name' => videos, 'orderby' => 1, ...


0

The code you show wraps your first post in a <div class='first-post'>...</div> element. You can add styles to it in your theme's CSS file(s) (either style.css or a custom one if you're loading custom styles): div.first-post { /* First Post styles here */ /* for example, if you want the text to be **bold** */ font-weight: bold; }


6

If the plugins are correctly adding their styles via wp_enqueue_style, you simply need to dequeue them: function wpa_dequeue_style() { wp_dequeue_style( 'plugin-style-handle' ); } add_action( 'wp_enqueue_scripts', 'wpa_dequeue_style', 100 ); Whether or not this works depends on how and where the plugins are adding their styles, so there's no absolute ...


0

I wrote a helper function for things like this. It's the first thing in all of my themes' functions.php files. /** * Cycle/alternate unlimited values of a given array. * For instance, if you call this function five times with wp_cycle('three', 'two', 'one'), * you will in return get: three two one three two. This is useful for loops and allows you to * ...


0

Here is a shorter version, using modulus 4 on the $wp_query->current_post while ( have_posts() ) : the_post(); ?> <li <?php echo ( $wp_query->current_post % 4 > 1 ) ? " class='custom-class' " : ""; ?>> <?php the_title();?> </li> endwhile; Here is a table showing what happens when ...


0

If this is a theme you can safely edit (ie. one you have built) then in your Loop, keep track of the posts on a cycle of 4. $qry = new WP_Query("showposts=10"); if ($qry->have_posts()) { $iter = 0; while($qry->have_posts()) { $iter++; $extra_class = ''; $qry->the_post(); if (3 == $iter || 4 == $iter) { $extra_class = ...


1

Filter post_class, use a static internal counter in the filter callback: add_filter( 'post_class', 'wpse_100804_post_class' ); function wpse_100804_post_class( $classes ) { static $counter = 0; $counter += 1; switch ( $counter ) { case 4: $counter = 0; case 3: $classes[] = 'extra'; } return ...


0

I use Sass and Compass, which offer numerous benefits beside CSS combining and compression. LESS is another great option, as mentioned by @Dalton above. It's not necessary to purchase CodeKit to use Sass or LESS (though it is a great app), as both are open-source.


2

Per the register_sidebars() Codex page, the CSS ID of the sidebars gets incremented by default. In other words, if you're not explicitly setting the id array value -- and in your code sample above, you aren't -- you would end up with sidebars with CSS IDs of sidebar and sidebar-2. You can then style them differently in your CSS file (be it style.css or a ...


0

This is a CSS-related question, more than a Wordpress related one. In your case all the rules that apply for normal CSS overriding are usable to solve your problem: Cascade: Apply the rules with the same specificity (same number and types of selectors) after the rules written by your plugin. The way to achieve this depends on which hook your plugin uses to ...


0

You could attack the get_pages(); function another way to sort your code better and read it better as well, take a look at this link for more info. <?php $args = array( 'sort_order' => 'ASC', 'sort_column' => 'post_title', // sorting by alphabetical order of post title for example 'hierarchical' => 1, 'exclude' => '', ...


0

Do you have this code corresponding to the style.css file that is in your main theme folder? <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" /> If you want to link to another name other than style.css or you have a different path you would want to use: <link rel="stylesheet" href="<?php bloginfo('template_directory'); ...


1

well you can have conditional if else statements to output different html for different pages, based on page id. But first modify your get_pages to fetch only those 4 pages(or 'sections' as you are calling it). The current code will show all the pages that are there on your website. I am pretty sure you don't want that. so instead of just $pages = ...



Top 50 recent answers are included