theBrettman
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Twenty-eleven sidebar issueI was wrong, actually. That turned out not to work. Twentyeleven actually has it’s own filter that works much easier. Here’s the function I actually used to do what I wanted:
add_filter( 'twentyeleven_layout_classes', 'one_column_classes', 10, 2 ); // Overrides layout classes for pages using one-column template function one_column_classes( $classes, $current_layout ) { $current_page_template = basename( get_page_template() ); if ( $current_page_template == 'one-column.php' ) { $classes = array( 'one-column', 'content' ); } return $classes; }
I’m sure I will need this later, lol.
Forum: Themes and Templates
In reply to: Twenty-eleven sidebar issueThat is not the right way to fix the problem. What you need to do is remove the body class(es) that it adds to the page and since the other styles exist, I replace them with them. There is a body_class filter you can use to filter it out. In my case, I need .two-column and .left-sidebar on all but the contact page and .one-column added to the contact page so I will make a template for the contact page by copying page.php and renaming it to one-column.php, remove get_sidebar(), and add some new code after get_header():
function one_column_body_class_switch( $wp_classes, $extra_classes ) { // Classes to remove $classes_to_remove = array( 'two-column', 'left-sidebar', 'right-sidebar' ); // array_diff() Returns the difference $wp_classes = array_diff( $wp_classes, $classes_to_remove ); // Classes to add $classes_to_add = array( 'one-column' ); // array_merge() merges all arrays to your new array return array_merge( $wp_classes, $classes_to_add, ( array ) $extra_classes ); } add_filter( 'body_class', 'one_column_body_class_switch', 10, 2 );
Now I can change the template on each page I want to be one-column. I could also do the same in another page for right-column if I wanted that option.
Ok, now you can mark this thread resolved! ??
Forum: Plugins
In reply to: Can't create table during activation…I thought it was the trailing comma on the last line but even removing that didn’t fix it. I ended up replacing
$wpdb->prepare()
with a regular sql string and it worked. Even$wpdb->query()
didn’t work. I took the example straight from the codex verbatim too and that didn’t work either! Someone should update the codex with a working example maybe?Forum: Themes and Templates
In reply to: Twenty Eleven header image size@danapalooza actually, it’s not a hard question to answer and belongs in this post. HEADER_IMAGE_HEIGHT and HEADER_IMAGE_WIDTH are just constants made by the twentyeleven theme that you use where you put the code into your header for the header image. You could make your own constants/variables, insert actual values, or just make custom templates for each page with different constants/variables or some code to set those values on whichever page but it sounds like it would be better to make a plugin to do this and not use HEADER_IMAGE_HEIGHT and HEADER_IMAGE_WIDTH. You could make your own plugin and make your own template tag that uses it and replace the code there with your template tag.
Forum: Themes and Templates
In reply to: Twenty Eleven header image sizeYou’re all doing it wrong! There’s two ways to do it right. Either make your own variable to replace HEADER_IMAGE_HEIGHT and HEADER_IMAGE_WIDTH in your functions.php and define a new variable (also replacing the variables in your template files), or remove the filter and redefine it in your functions.php:
remove_filter( 'HEADER_IMAGE_WIDTH', 'twentyeleven_header_image_width' ); remove_filter( 'HEADER_IMAGE_HEIGHT', 'twentyeleven_header_image_height' ); define( 'HEADER_IMAGE_WIDTH', apply_filters( 'child_header_image_width', 1280 ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'child_header_image_height', 200 ) );
I prefer the latter so I don’t have to find/replace HEADER_IMAGE_WIDTH & HEADER_IMAGE_HEIGHT with new variables. I just add those four lines to my functions.php and I’m done! Since it is in my child theme, I never have to worry about it getting overwritten on update and if you don’t remove_filter() on each first, it will show in your debug log (if you use one) because those variables are already defined.
Forum: Fixing WordPress
In reply to: Child theme not overriding parent in 3.3Did you ever figure it out? It doesn’t make any sense to me why your stylesheet wouldn’t take precedence. Do you know how to use the code inspector in chrome or firebug in firefox to see your styles and how they’re processed?
Forum: Fixing WordPress
In reply to: Child theme broken after updating to 3.3Problem resolved. I was entering the Theme Name from the parent into Template on the child theme which was “BlogoLife” when it’s supposed to be the name of the parent folder which is “blogolife”. Somehow, 3.2.1 was case-insensitive because it shouldn’t have worked in 3.2.1 either.
Forum: Fixing WordPress
In reply to: Child theme not overriding parent in 3.3scratch what I said about template saying the same thing as theme name of the other theme. it should be the name of the parent themes folder but is still case sensitive though…
Forum: Fixing WordPress
In reply to: Child theme not overriding parent in 3.3I changed stylesheet. you keep template as the parent. mine is currently using the parent theme with the child theme stylesheet because it wasn’t changed with wordpress but in the backend. where your stylesheet says template, check that the value twentyten is the same as where twentyten’s stylesheet says theme name (it IS case sensitive). Also, your child theme’s folder should be in wp-content/themes/ and not in the parent theme’s folder (some people do that and wonder why it doesn’t work).
Forum: Fixing WordPress
In reply to: Child theme not overriding parent in 3.3does it say that your child theme has no parent installed on the themes page? My child themes broke when updating to 3.3 and it says the parent isn’t installed even though I can activate it. unfortunately, after activating, I couldn’t activate the child theme anymore so I had to find stylesheet under wp_options in the database and change it to the folder name of the child theme as a work around till wordpress gets this bug resolved…
Forum: Fixing WordPress
In reply to: Child theme broken after updating to 3.3Till this is resolved, I went into the phpmyadmin and changed stylesheet under wp_options to the folder name of the child theme and it is now using the whole theme again. Still says the themes are broken! Isn’t EVERYONE ELSE having this problem?
Forum: Fixing WordPress
In reply to: Child theme broken after updating to 3.3It’s not just with that theme, it’s ANY child theme. I just made one for Twenty Eleven and it says the same thing. The client didn’t know to backup the database before updating either.
Forum: Fixing WordPress
In reply to: Child theme broken after updating to 3.3sure enough, got the nerve up to activate the parent theme and that didn’t fix the problem. now I can’t activate the child theme. this should work! wth? Nothing changed except to update wordpress and the parent theme is blogolife and hadn’t changed any.
Forum: Fixing WordPress
In reply to: sub categories drop down menu not showingI see you fixed it. Did you change themes or did you figure out how to add support? I’m using a blank theme that came with a lynda.com training video cuz it’s minimal. twentyten is just too much stuff to style and gets to be a pain. only problem with the blank theme is that it’s missing a lot of functionality and I’m having problems getting sub-menu’s to work now. I think all it’s missing is a jquery script to show/hide the sub-menu.
Forum: Themes and Templates
In reply to: Integrating WP in external PHP pagesThis doesn’t make sense? Why would I want the header, sidebar, or footer in my form action php file? All I want to do is use ajaxform() to call my action php file and maybe return something to a div somewhere on the page. I get 404 of course but I don’t want the header being returned or anything else. I just want to email the form data. none of the wordpress form plugins will make tabular forms the way I want and I can’t add what content I want where I want so I’m not using a plugin. just jquery ajaxform() and a simple php file.
I tried
require_once("./wp-load.php");
and it didn’t work. My form looks like:<form id="form0" action="bbaction.php" method="post">
bbaction.php looks like:<?php require_once("./wp-load.php"); foreach($_POST as $name => $value) { print "$name : $value<br>"; } ?>
(for now I’m just trying to print the results to a div on the page so I can style what the email will look like)
and then my js looks like this:$(document).ready(function() { var options = { target: '#test' $('#form0').ajaxForm(options); });
Anyone know what I’m doing wrong?