Half-Elf on Tech

Thoughts From a Professional Lesbian

Author: Ipstenu (Mika Epstein)

  • A Theme By Any Other Name

    A Theme By Any Other Name

    When I redesigned my sites earlier this year I struggled with some concepts that later drove me away from child themes and into the arms of custom plugins. The issue at heart is that the term ‘theme’ is used in far too broad and encompassing a manner, which confuses people when they find out there are different types of themes. And no, I don’t mean responsive vs static vs mobile. I touched on this earlier in the year when I reviewed the very concept of managed themes, but apparently I didn’t do it well enough.

    After some talks on WP-Hackers, I’ve got a better list.

    • Theme – The traditional theme.
      • Child/Parent Themes
    • Theme Framework – Can be used as a traditional theme, normally used as a parent.
      • Starter Theme – Never used as a standalone theme, only used to build themes.
      • Managed Theme – A theme that acts like a framework and a child at the same time.

    So let’s look at them in order.

    Theme

    Example: TwentyEleven, Buttercream, pretty much anything in wordpress.org

    This is the most basic, simple, normal theme in the world. It works right out of the box. You can make a child if you have to, but most people don’t. Themes may or may not be built off of a Theme Framework, but they can all be used as is, no alterations needed.

    Child / Parent Themes

    The short version here is that child themes are built off a parent. A parent can be any of the themes here (Theme, Managed, or Framework). A child theme can never be a ‘theme’ however, it can never stand on it’s own. And there are some themes that don’t support children at all. The parent/child relationship muddies the waters quite a bit when it comes to understanding what type of theme you have, but I would go with the basic rule of “If a theme requires another theme to be installed separately, it’s a child theme.”

    Theme Framework

    Examples: Hybrid, Genesis

    These themes are crazy robust. It’s like taking a normal theme, giving it steroids, and then handing you toolkits to expand it. Theme Frameworks can be used as a theme themselves, but often are treated as either Starters or Managed (see below). Frameworks come with a bunch of new, extra functions, along with documentation. Oh yes, these babies are documented so the theme guru can carry on, or the newbie can learn all about how themes work.

    There are two types of Frameworks (and this is where people will disagree with me a lot).

    Starter Theme

    Example: _s, Bootstrap, Hybrid

    These are used to build a parent theme off of, and cannot stand on their own as a theme (they’re skeletons). No one actually uses the theme as a theme on it’s own without forking and adding in their bells and whistles. These are turned into full-blown themes, and use the normal parent/child relationships from there out (which is why they’re a subset of frameworks). The starter theme itself is not a stand-alone theme, however, and the person who builds their parent theme off these ‘framework’ is responsible for updating their theme when the framework is updated.

    Managed Theme

    Example: Genesis, Thesis

    A managed theme is usually built on a framework, but unlike a starter theme, these can be used as is if you want. The real difference is not that, however, but that everything that you should be doing is within the WP Dashboard. All CSS tweaks, and even functions, can be added there-in, and not the functions.php files. Sometimes these are just parent themes that you don’t make children off of, ever, and others are children themselves of a framework. The best ones have a way to export your theme settings. To make things easier, you’ll find a lot of plugins that do what most people want, and they never need to edit code.

    Drawing The Lines

    What is a theme and what is a plugin, then? I was trying to explain this to a non-techy the other day, and jokingly said “You know how Barbie has all those clothes you can put on her, like the ski outfit? That’s a theme. A plugin is the Barbie Camper.” As horrific as the metaphor is, it’s not inaccurate. The theme changes the design, the plugin changes the function. Many theme developers hate putting code like Custom Post Types into their themes, because they feel that code should be separate from theme, and you should be able to keep your content, no matter what theme you’re using.

    For a long time I never used ‘starter’ as a theme designation, because to me the word ‘framework’ meant ‘a frame I build off of.’ With the conversations I had on wp-hacker in mind, I have reclassified themes into two types. Themes and Theme Frameworks. That’s it. That’s all you get. And yes, that means I think a Starter Theme is a framework. Look, Genesis, Hybrid-Core, and Bootstrap are all themes that someone uses to build other themes. They’re all frames that people can use to paint their own masterpiece.

    When you start looking at managed vs starter, it gets clearer. I call Genesis managed because that’s how the end users will see it. It’s not a starter, because people don’t fork Genesis to make a new theme, they use it and make children.

    The following explanation is using the two frameworks I’m most familiar with.

    Hybrid is a Starter Theme Framework. People download it, extend it into their own theme (see Oxygen, News, etc, all of which are stand-alone themes in the repository), and use those themes as full born ‘traditional looking’ themes. They can make children theme, but the point is not that Oxygen (built off Hybrid) is a theme or not, but that Hybrid, it’s source, is not a theme, but a Framework. They are separate things.

    Gensis is a Managed Theme Framework. It remains a separate parent theme, and technically can be used as is (it’s a very nice basic theme), so in that way it’s a Framework, but people don’t take that as a base theme and extend it like they do Hybrid. When you make a child theme of Genesis, it’s a true child theme, and never a copy of Genesis, renamed, and extended. Thus, Genesis could be a framework, but it’s really a managed theme because you never fork it, you always manage it via the dashboard or a child theme. Genesis is a theme built off a framework, and no one else uses that framework but Genesis.

    If you treat everything like a nail, you’ll always use a hammer. And a nail will go wherever you want if you hit it hard enough. I don’t suggest that, by the way, and as a principle of forcing your way on everyone, it’s not a good one. Treating all theme types as exactly the same will get you into trouble. If I extend one the nail/screw metaphor, one reason themes take on so much is that they can’t install plugins. Managed themes are a great example of themes crossing the line between being a hammer (theme) and a screw (plugin).

    A starter theme framework is Home Depot. All the tools are there, there’s even some help, but you’re going to pick out your tools and your lumber and build what you want. When you need more, you can invent and create anything you want. You may have to go back to the store and buy more nails and screws, but your limit is your own ability and imagination.

    A managed theme framework is Ikea, with that Ikea Toolkit. It has all the parts you need, and while you can hack the bookshelf into a standing desk with little work, and no extra parts, you’re meant to use it out of the box and follow their directions to design differently. And when you need more, there are plugins to add on to what you have to make it more. Within limits.

    My Recommendation

    Use what you like, but understand what you’re using.

    Themes are very personal. A plugin is easy, you want something to fit a specific niche, you find it, you use it. You may pick one over another based on ease of personal usability, but the final function is the real deal breaker. A theme, on the other hand, has to look right and feel right to use, and that’s very, very hard. No matter which one I use, and I use a theme, a framework, and a managed all on my sites, I make sure it meets my feel-good and my needs. I know I’m perfectly comfortable hacking functions to bend to my whim, but if I was handing over a theme to someone less techy, I would think twice.

    When you’re making a site for someone else, think about how much you want to support. The more complex a theme, and the harder for the users to edit it, the more calls you get. Even when you’re making a site for yourself, you have to know what kind of theme you have, and the best way to edit it. If you’re using a stand-alone theme, built on a framework or not, once you know how to use child themes you’re good to go. But a managed theme may be a new learning curve for you, so remember to take time and ask around for how to use this theme the best way.

    The best thing about learning to use a managed theme is that they’re usually used to the newbies, so for an experienced theme dev, that learning curve is short and shallow. You already know how to find the docs, read them, and apply them. You know that there will be options, between editing functions.php and using a plugin, and you can weigh the pros and cons for yourself and your clients.

    Understand what you’re using, understand how it works, and use what makes you happy.

  • Switching Network Types

    Switching Network Types

    This actually isn’t hard to do, but it can be tricky to complete if you don’t remember what you started with.

    To start with, let’s say I have a multisite with subdomains: ipstenu.loc. I’ve added in two subsites, foo.ipstenu.loc and bar.ipstenu.loc. But then I decide I really wanted to have ipstenu.loc/bar and ipstenu.loc/foo instead.

    The easy part is first. I know my wp-config.php has this:

    define('WP_ALLOW_MULTISITE', true);
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    $base = '/';
    define('DOMAIN_CURRENT_SITE', 'ipstenu.loc');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('BLOG_ID_CURRENT_SITE',1);
    

    All I have to change is the one line define('SUBDOMAIN_INSTALL', true); to define('SUBDOMAIN_INSTALL', false); and now I’m using sub-folders!

    But that means that foo.ipstenu.loc isn’t really valid. Amusingly, it doesn’t break anything at first, so the still will work. But once I change the .htaccess, things will get hinky, so I’m going to do the ‘hard’ part.

    Go in to Network Admin -> Sites and Edit each site that uses a subdomain and you’ll see this:

    Looks familiar, right? I’m going to change foo.ipstenu.org to ipstenu.org and the line with / becomes /foo/:

    As soon as I hit save, the site is ‘moved.’ Great! Do this for all my sites and .. wait. Now they look all ugly!

    That’s because I have to edit the .htaccess. Go to Network Admin -> Settings -> Network Setup, and copy the .htaccess from there, replace, and now it works too.

    The one last step is re-saving the permalinks in your main site, and remembering your links are about to break. What’s that now? Oh, yes, you see ipstenu.loc now gets /blog/ shoved in for any posts, so ipstenu.org/2012/postname became ipstenu.loc/blog/2012/postname. The catch here is that if you don’t resave the permalinks, they will continue to work until you do. Once you hit ‘save’ on permalinks, blog jumps in, and WordPress cheerfully redirects people for you, so you lose nothing.

    And now you know!

  • Google Apps

    Google Apps

    Google AppsI don’t like Google very much. However when my grandmother had a request for something to be added to her website, I realized Google’s email would actually be much easier for them, especially since her domain, taffys.org, is mapped to this server as a part of my Multisite network. Oh, it’s not terribly hard to make emails for her, but she wanted someone local to do that.

    There’s a minor story behind that, but the shortest version is she’s doing some totally awesome not-for-profit work with Parkinsons patients. One of the things she wants is an email, used by many people, to ‘collect’ messages like ‘I’ll be there.’ While I could do this on my site, it’s actually easier to get this up on Google, where I can tell people login to go to http://mail.google.com/a/taffys.org or http://mail.taffys.org and it’s something they know.

    I chose to do this by command line, for the experience. If I wanted to do it via cpanel and WHM, you’d go in to edit the DNS zone for the server and add in the mx records.

    MX Records

    The command dig mx taffys.org tells me what I have right now, which I knew was self referential.

    ; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.5 <<>> mx taffys.org
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20605
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 1
    
    ;; QUESTION SECTION:
    ;taffys.org.			IN	MX
    
    ;; ANSWER SECTION:
    taffys.org.		14010	IN	MX	0 taffys.org.
    
    ;; AUTHORITY SECTION:
    taffys.org.		78943	IN	NS	ns1.ipstenu.org.
    taffys.org.		78943	IN	NS	ns2.ipstenu.org.
    
    ;; ADDITIONAL SECTION:
    taffys.org.		6943	IN	A	50.28.84.96
    
    ;; Query time: 11 msec
    ;; SERVER: 69.167.128.254#53(69.167.128.254)
    ;; WHEN: Tue Nov 13 08:09:06 2012
    ;; MSG SIZE  rcvd: 104
    

    Looks like that for all my stuff. Okay, no problem, I go in and edit /var/named/taffys.org.db and find this:

    taffys.org. IN MX 0 taffys.org.
    

    Change it to this:

    ; Original
    ; taffys.org. IN MX 0 taffys.org.
    
    ; Gmail
    taffys.org.             14400   IN      MX      10 ASPMX.L.GOOGLE.COM.
    taffys.org.             14400   IN      MX      30 ASPMX2.GOOGLEMAIL.COM.
    taffys.org.             14400   IN      MX      20 ALT1.ASPMX.L.GOOGLE.COM.
    taffys.org.             14400   IN      MX      30 ASPMX4.GOOGLEMAIL.COM.
    taffys.org.             14400   IN      MX      30 ASPMX5.GOOGLEMAIL.COM.
    taffys.org.             14400   IN      MX      20 ALT2.ASPMX.L.GOOGLE.COM.
    taffys.org.             14400   IN      MX      30 ASPMX3.GOOGLEMAIL.COM.
    

    And then I ran /usr/sbin/rndc reload taffys.org to refresh it. But ... wait. Why does it still say I'm on taffys.org? Per usual, I didn't bother to change my TTL. As everyone always reminds me, if you make a change to DNS without lowering your TTL values, you're gonna have a bad time. Since I'm (rarely) in a rush for this stuff, meh. Besides, it takes 24-48 hours from changing TTL for it to be usable, and then I can make my change. Followed by waiting again, and then changing it back? DNS is pretty zippy these days. 72 hours max, and usually less, so I just don't.

    While I waited on that, I went ahead and made a Google Apps account for taffys.org. When you go to Google Apps they only show you business and education. I'm neither (though I suppose what I'm doing for Taffy would be non-profit). Really they're trying to sell, which makes sense. If you go to their pricing model, you'll see the free option. Unless you're running a business, click that.

    The rest of the directions are really straight forward, and Google shows you what to do. It's really just set up the account stuff from there out. The directions to make mail.yourdomain.com are under Create a custom web address.

    If you want to do it with a GUI, it's even easier. I went into my DNS management setup on cpanel and did this:

    Will I do this for other domains? Maybe. I think I'll be doing this for hosting going forward, since the people I host rarely (ever?) use cPanel. Congrats, Taffy! You're the first! Liv's the second.

    Now I have to fix up Taffy's site.

  • Sidebar Login Widget

    Sidebar Login Widget

    This comes up a lot.

    The basic concept is you want to allow users to log in and out via a sidebar, and never see the admin-end of WP. There’s an awesome plugin called Sidebar Login that already does this, but I decided to play around and make a dead simple widget. There’s no ajax going on here, and very little code since it all calls the built in functions and filters.

    It lets you make a few choices, as to what verbiage you want to use, and if you want to show login/registration info or not. The registration link won’t work if you have registration turned off, natch.

    All the code is here at Hack: Sidebar Login Widget

    Really those hacks are more ‘mu-plugins’ that I don’t want to support, but still wrote, but you get the idea.

    I’ve taken to writing up the code, when I can, for people in the forums a little more, since it helps me as a developer get better with WordPress. I’m still new at wrangling widgets, so this was a new, and interesting, experience for me. That brought up questions for me, as to where people like the plugin ‘settings’ to be.

    [polldaddy poll=6676462]

  • Sidebar Login Widget

    Sidebar Login Widget

    So this happened after people asked me about how to make a widget. This makes a slightly customizable widget that will let you have a slightly customized login form via a widget.

    As with all hacks, you’re on your own for support. Code is GPLv2, and it should be translatable.

    Download Code

    The code is in a .txt file. Rename if .php and toss it in mu-plugins

    Download TXT

    Code

    .

    Sidebar Login Widget is released WITHOUT any support, and you can
    use it at your own risk. The code should work, but I’m not spending
    a lot of time on it.
    */

    if (!defined(‘ABSPATH’)) {
    die();
    }

    // Register the widget
    function sli_register_widgets() {
    register_widget( ‘sli_SLI_widget’ );
    }
    add_action( ‘widgets_init’, ‘sli_register_widgets’ );

    // This is the widget!
    class sli_SLI_widget extends WP_Widget {

    function sli_SLI_widget() {
    $widget_ops = array( ‘classname’ => ‘sli_add_users’, ‘description’ => ‘Sidebar Login Form.’ );
    $control_ops = array( ‘width’ => 300, ‘height’ => 350, ‘id_base’ => ‘sli-add-user-widget’ );
    $this->WP_Widget( ‘sli-add-user-widget’, ‘Sidebar Login’, $widget_ops, $control_ops );
    }

    function widget( $args, $instance ) {
    extract( $args );

    /* User-selected settings. */
    $title = apply_filters(‘widget_title’, $instance[‘title’] );
    $errormsg = $instance[‘errormsg’];
    $lostmsg = $instance[‘lostmsg’];
    $show_for = $instance[‘show_for’];
    $show_reg = $instance[‘show_reg’];

    /* Before widget (defined by themes). */
    echo $before_widget;

    /* Title of widget (before and after defined by themes). */
    if ( $title )
    echo $before_title . $title . $after_title;

    // Code Goes Here

    global $user_login, $post;
    $redirect = $_SERVER[‘REQUEST_URI’];

    if (isset($_GET[‘sli’])) {
    $sli = $_GET[‘sli’];
    if ($sli == ‘fail’) { echo “

    “. $errormsg .”

    “; }
    if ($sli == ‘lost’) { echo “

    “. $lostmsg .”

    “; }
    }

    if (is_user_logged_in()) {
    _e( ‘Howdy’, ‘helfsli’ );
    echo $user_login, ‘. Logout‘;
    } else {
    wp_login_form(array( ‘value_remember’ => 1, ‘redirect’ => $redirect));

    if ( $show_reg && get_option(‘users_can_register’) ) {echo wp_register(”, ”);}
    if ( $show_reg && $show_for) {echo ‘ | ‘;}
    if ( $show_for) {echo ‘Lost Password‘;}

    }

    /* After widget (defined by themes). */
    echo $after_widget;
    }

    function update( $new_instance, $old_instance ) {
    $instance = $old_instance;

    /* Strip tags (if needed) and update the widget settings. */
    $instance[‘title’] = strip_tags( $new_instance[‘title’] );
    $instance[‘errormsg’] = strip_tags( $new_instance[‘errormsg’] );
    $instance[‘lostmsg’] = strip_tags( $new_instance[‘lostmsg’] );
    $instance[‘show_for’] = $new_instance[‘show_for’];
    $instance[‘show_reg’] = $new_instance[‘show_reg’];
    return $instance;
    }

    function form( $instance ) {

    /* Set up some default widget settings. */
    $defaults = array( ‘title’ => ‘Log In’, ‘errormsg’ => ‘Error: Incorrect username/password’, ‘lostmsg’ => ‘Password reset sent.’, ‘show_for’ => false, ‘show_reg’ => false, ‘show_sex’ => true );
    $instance = wp_parse_args( (array) $instance, $defaults ); ?>


  • SEO: Impossible

    SEO: Impossible

    For someone who thinks SEO is crap, I sure talk about it a lot. Google’s got a new toy: Dissavow links.

    In the wake of Panda, a lot of sites got hit with bad SEO rankings from having crappy backlinks. In specific, I know many WordPress theme developers were hurt, including WPMUDev, because spammers and scammers used their themes. Basically their own popularity bit them in the ass, through no fault of their own save their success. After all, a pretty common question people have is “Do those crappy, low-quality inbound links hurt me?” And most of the time, the answer was no. Except when it did with Panda. At the time, it didn’t seem fair to anyone that your popularity would be detrimental to your SEO, and thus we have Dissavow. (Amusingly enough, Bing got there first.)

    But what does it do? Here’s Matt Cuts explaining this:

    For the rest of us, it lets you say ‘These links are crap and they’re not related to me, so please don’t let them impact my search ranking.’ Many of you are looking confused here, and wondering why they impacted you in the first place. After all, it’s not your responsibility to monitor the quality of sites on the Internet, is it? That’s why Google and Bing make the big bucks. And yet we all know how terrible search results can be, and frankly Google’s blog search is horrible. I have to hand it to Google, though. Search is hard, and crowdsourcing the work of teaching a computer what is and is not spam is actually a good idea.

    Google (and Bing’s) methodology rub me wrong. Now that Google has us doing the work for them, by picking out spammy sites and effectively reporting them, you’d think all is good for the theme world. Alas, not so. I’ve heard rumblings that Google is now asking theme developers to remove backlinks!

    While I don’t feel a theme developer will be broken for this, it will make it much harder for them to promote their works. On the plugin end of things, I’ve had people ask me to remove their plugins because we don’t permit WordPress plugins to show backlinks unless they’re opt-in, and this means the dev can’t make money. Part of why is that you can have hundreds of plugins, but only one active theme. The other part is we feel it looks spammy. Now, so does Google.

    But all that aside, if you want to disavow your backlinks, you can now do it, and the directions aren’t complicated. Click on the disavow link, upload a text file formatted in a certain way, reap benefits. Sounds great, right? What if I told you that Google sends you no confirmation at all? There’s no confirmation, no way to see if what you did worked or not, and worst of all, this could take weeks, if not months, for them to crawl, sort, and re-crawl your sites. During that time, you hear nothing. When it’s done, you hear nothing.

    You do all this work and end up in a vacuous hole of ‘well, there’s that then’ with no assurance of anything at all being done. That caught my attention in a bad way. How can I tell I’ve done the right thing? We’re already being killed by not being able to track encrypted search terms, and now we’re not going to be able to tell if removing the links from the bad people is going to help our SERP?

    This is why I think SEO is full of it. To one degree or another, it’s always been about gaming the system, and tricking search engines into letting you rise to the top. Meta tags trumped quality, and then it was links (because obviously if people link to you, you’re valuable). Now we know people game links, so we remove that, which actually doesn’t hurt as much as you think. See, a lot of your search engine ranking came from the quality of sites that linked back to you. But the most valuable sites (like MediaWiki) have stringent policies and rules about not linking, or linking and using nofollow, to prevent you from getting link-juice. In the case of MediaWiki, it makes sense since anyone can edit it.

    But…

    That just went to prove the system was broken. Blogs (WordPress included) nofollows comment links for the same reason. If the door was open, the spammers would use it and make themselves look more important. And as the tools got smarter and started making those links worthless, the spammers started scraping your quality content, which Google et al had to learn to filter. We’re at the point where links are valueless. It doesn’t matter who links to you anymore, because none of the good sites will give you a lot of value since they’re trying to get rid of the spammers. So why is Google giving any weight to these spammer links?

    If the state of link-relativity is so poor that search engines are asking us to remove backlinks from themes, and also to tell them which links to us are worthless, then all links are more trouble than they’re worth and we need to figure out a better way to measure the usefulness of our sites. What measuring sticks do you use?