Log in

Stephanie C. Leary [entries|archive|friends|userinfo]
Stephanie C. Leary

[ website | stephanieleary.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Redirect 404 errors to imported posts using path custom field [May. 25th, 2016|10:21 am]
Stephanie C. Leary
[Tags|, , , , , ]

Are you importing posts from another CMS? Do you want to avoid an .htaccess file with a million redirects? Of course you do!

Step 1: store your old pages’ paths in a custom field during your import.

Step 2: adapt this little function to your site. When a user lands on a 404 error, WordPress checks to see if the requested path exists in a custom field. If so, it redirects the user to the correct post.

In this case, my posts imported from Drupal had the old paths stored in the ‘drupal_path’ field.  Change your ‘meta_key’ to match your custom field name.

Try visiting one of the old URLs. You should be whisked to the new location.

This function also prevents WordPress’s default behavior of trying to guess where to redirect an incorrect URL. If you want WordPress to keep doing that after it has checked for the custom field path, simply remove the “else return false;” lines.

Redirects for HTML Import

Since the HTML Import plugin stores the old URLs, you can use this to redirect your old files to the new WordPress pages:

Note the difference here: parse_url() isn’t used, because in this case the full URL has been stored, not just a relative path.

This works only if you have entered the old URL correctly in the plugin’s settings.

Originally published at Stephanie Leary. You can comment here or there.

LinkLeave a comment

Better 404 error messages for private posts and pages [May. 18th, 2016|09:16 am]
Stephanie C. Leary
[Tags|, , , ]

When a non-logged-in reader visits a private WordPress post or page, she gets a 404 “not found” error message, as if the post didn’t exist at all. That’s great if you don’t want the world to know that the post exists, but what if you’re doing something less clandestine, like members-only content?  You do want people to know the post is there–they haven’t followed a bad link!–but they need to log in to see it. Then “not found” is misleading.

There are two ways you could make the user experience better: redirecting private 404s to the login screen with a message, or changing the 404 error text.

Redirecting private 404s to the login screen

If you’re going with the redirect option, you’ll need two small functions in your custom plugin or your theme’s functions.php file. The first checks whether the queried object (in this case, the post/page) is private, and if so, redirects to the login URL with a custom query argument and instructions to return the user to the original page after they’ve logged in.

The second function runs on the login screen. If the custom query argument is set, it adds a message telling the user they need to log in before viewing the original page.

Changing the 404 error text (in Genesis)

If you want to be a little less presumptuous about whisking users off to a login screen, you can instead filter the error message and give them the option of following the login link.

In most WordPress themes, you can edit your template files directly to add a wp_login_url() link. In Genesis, you need to filter the noposts text instead:

Originally published at Stephanie Leary. You can comment here or there.

LinkLeave a comment

A better color scheme chooser for Genesis [May. 12th, 2016|11:00 am]
Stephanie C. Leary
[Tags|, ]

Most Genesis themes come with several color schemes. However, most of the time, these feature one prominent color. The built-in color scheme chooser is therefore a simple dropdown list of color names: Red, Green, and so on.

When I started talking to the Berkeley College of Engineering‘s Marketing staff about creating a flexible WordPress theme for the College’s various divisions to use, they mentioned early on that they’d like several different color schemes based on the university’s brand guide. Berkeley, as it turns out, has a fantastic color guide.

colorgrid800I had so much fun mixing up the colors that I couldn’t stop, and I very quickly found myself with twelve color schemes. (Really six, but each has a light and dark variation.)

The problem was that none of the color schemes had one single standout color; they each had more like four. And that meant that the usual Genesis color-name dropdown was not going to cut it.

Instead, I removed the original Genesis Color Schemes meta box and replaced it with a new one based on the Layout Settings box. I created icon images for each color scheme, added a few lines of CSS to accommodate my images’ taller height, add space for captions, and make the selector border stand out a little more.

The end result gives site owners a much better idea of what the color schemes look like.


Here’s the PHP. You’d need to copy this to your theme (probably in functions.php) to create something like this for your site:

Note that there are images for each color scheme, all stored in the theme’s /images subdirectory. You might need to change the filename and path logic, depending on your setup.

And here’s the admin-style.css file referenced:

Read more about the Berkeley College of Engineering theme project.

Originally published at Stephanie Leary. You can comment here or there.

LinkLeave a comment

Where has Stephanie been for the last year? [Apr. 27th, 2016|01:17 pm]
Stephanie C. Leary
[Tags|, ]

To sum up in one word: depression.

There are lots and lots of other symptoms and side effects wrapped up in that. Chronic fatigue. Insomnia. (Often in combination; what fun!) Medication changes, with all the shenanigans that entails. Apathy. Lack of focus, also known as “brain fog,” which sounds like a diagnosis out of Joe vs. the Volcano.

brain-cloudThings depression did not help me accomplish: Anything. No writing to speak of, no print edition of Content Strategy for WordPress, no posts here, no plugin updates or support, no WordCamps, no pithy livetweeting, no hanging out in the #wordpress IRC or Slack channels, not much social media at all. I basically didn’t work for five months last year, and then worked really really hard for a few months to catch up.

I’m slowly coming out of hibernation and getting back into my usual circles. I’ll be at Paradise Lost this weekend, WPCampus in July and HighEdWeb in October. In the meantime, I hope to update CS4WP and get a second edition out–in both print and digital this time.

If you’ve pinged me on Facebook or Twitter to see how I was doing–thank you! It’s reassuring that my disappearance did not go unnoticed, and I appreciate your kindness.

Originally published at Stephanie Leary. You can comment here or there.

LinkLeave a comment

Pro tip: a “women in…” industry panel should include, y’know, women. [May. 26th, 2015|10:34 am]
Stephanie C. Leary
[Tags|, , , ]

Denver ComicCon’s Women in Comics panel on Saturday featured… no women. Let’s have the allmalepanels Hasselhoff of approval, folks:

When asked about this, the convention’s PR rep responded with a prime example of how not to respond to questions about your problematic programming:

In regards to the Women in Comics panel, I think it’s important to point out that it was a panel that took an historical view of women characters in comic books rather than the current role of women creators in the industry or diversity in comics — of which DCC has many with appropriately diverse panels.
It was about the past, not the present! So the inherent sexism is totes okay and appropriate! Besides, we had lots of other diverse panels! Just not on this subject.
The Women in Comics panel was a submitted panel that featured respected academics on the subject.
A bunch of dudes suggested it! Who are we to tell them they should have included some ladies? Like, maybe the foremost authority on the subject WHO IS ALSO A GUEST AT THIS CONVENTION.
What, there’s a movement for men to pledge not to participate in all-male panels? Nope, never heard of that. Would never mention such a thing to the awesome dudes who submit panels to us.
And there’s, like, no way that bias in academia played any role whatsoever in the fact that a bunch of dudes are the only experts we respect. Nuh-uh.
As for panel acceptance: Denver Comic Con vets panels based on their proposal. The con values all different points of view, as long as their purpose is educational, and not hate speech, harassing in purpose, or strictly self-promotional. We don’t, however, “edit” the content because that might considered imposing our point of view over our panelists.
We can’t, like, curate our own convention programming. That would be wrong!
This particular panel was a last minute addition because the program director respects the submitter’s qualifications and scholarship, had an open slot, and wanted a panel on the history of comics. We didn’t think it would be appropriate to deny the panel simply because of his gender.
We didn’t have time to suggest changes! Not that we would have, anyway, because that would be wrong.
Also, the guy running our programming saw nothing wrong with this! In fact, it sounds like he solicited the panel. So it’s totes okay!
After all, we wouldn’t want to be accused of reverse sexism!
This PR guy is slapping together half a dozen different incoherent defenses because the panel is indefensible. No group of men should ever submit a panel on “women in” anything. No programming director should approve such a panel, especially when, again, the foremost expert on the subject, who is a woman, is also a guest at the same convention.
It is okay for the programming committee to suggest to an all-male panel that they modify their slate to include some women, and if the panelists do not agree, it is okay to reject their panel–yes, because of their gender.  “Reverse sexism” is impossible, because sexism is systematic, institutional oppression of one sex. (Individual women hating men is misandry, and individuals do not have the power of institutions.) Women, as the oppressed group, do not have the institutional power to oppress men in reverse. That’s how patriarchy works.
So, the institution–in this case, the convention programming committee–should absolutely say, “We’re not going to allow all-male panels, especially on the subject of women.” That’s not sexism; that’s preventing sexism.
Instead, the programming director allowed the panel–or perhaps even solicited it.
Speakers, don’t submit all-male panels to conventions. Most especially do not be a mansplaining jackass by submitting an all-male panel on the subject of women in your industry. Take the pledge not to participate in all-male panels.
Convention organizers, stop perpetuating this sexist bullshit and start curating your programming. This is a fucking disgrace, and no amount of PR spin can make it better.

Originally published at Stephanie Leary. You can comment here or there.

LinkLeave a comment

Happiness is... [May. 19th, 2015|07:41 pm]
Stephanie C. Leary
Another writing group, seated next to my group, critiquing each other loudly and with much hilarity while we smile to ourselves and keep on typing.
LinkLeave a comment

(no subject) [May. 12th, 2015|07:38 pm]
Stephanie C. Leary
[Tags|, , , ]

"Steve Rogers: PR Disaster" is one of the funniest fanfics I have ever read.

“Wait,” says Sam, “you had a publicist?”

“For my first five months at S.H.I.E.L.D,” says Steve. “Then she quit. Uh, decisively.”

“Well yeah, she had to keep you in line,” Bucky says with a half-smirk. “How many times did you make that poor lady want to sock you in the face?”

“Lost count,” Steve admits. “I did offer to let her, once. Seemed fair.”

Sam laughs. “I feel like you’re sitting on a story here.”

“There’s no story,” Steve tells him. Sam raises his eyebrows. Bucky’s half-smirk tilts towards a full smirk. “Seriously,” Steve repeats, “no story.”

Interlude: The Story of Steve “Walking PR Nightmare” Rogers, and How For a Short While He Single-Handedly Destroyed the Emotional Health of Eva Laura Ortiz, His Now Ex-Publicist

LinkLeave a comment

MY BOOK IS FINALLY OUT OMG [Apr. 28th, 2015|12:13 pm]
Stephanie C. Leary
[Tags|, ]
[Current Mood |productiveproductive]

Content Strategy for WordPress ebookThe "new WordPress book" I've been talking about for over a year is finally out. Check out the announcement if you're into WordPress.

This is my first self-publishing venture. So far, my reaction is: not that much more work, LOTS more control, worldwide availability, 200-300% more money per copy (depending on the vendor). Yeah, I could get used to that. I'll write up my thoughts on the process after I do the print edition.
Link4 comments|Leave a comment

(no subject) [Jun. 23rd, 2014|03:03 pm]
Stephanie C. Leary
[Tags|, ]

Threw my back out again yesterday. Have been more or less incapacitated. At least today I can get out of bed; going to the bathroom last night involved a lot of swearing.

Oh, hey, Mercury IS in retrograde.

Posted via m.livejournal.com.

LinkLeave a comment

ugh. [Jun. 21st, 2014|03:58 pm]
Stephanie C. Leary
[Current Mood |crabby]

I was supposed to fly to Chicago on Wednesday for a writing retreat. Instead I came down with a horrible stomach bug, with some extra-weird virus symptoms, and ended up going to the ER twice before noon.

I've been holed up at my parents' being fed Jell-O and soup. I'm fine now, but I'm just now sitting down to write for the first time this week (at 4pm on Saturday) and I am SO ANNOYED that I didn't get to see my long-distance friends, didn't get a nice long break for writing, and have now had two retreats this year ruined by illness.
LinkLeave a comment

[ viewing | most recent entries ]
[ go | earlier ]