Catharsis – WP Child Theme Evolution

It is always a wonderful feeling to figure something out, especially after having struggled with it. The following is a continued progression from one idea in 2011 to this idea in February of 2014 and then merged with this tangential idea from February 2014. The new child theme is here.

So at this point, I have a workflow that starts with a bookmarklet that

To business . . .

Bookmarklet Modifications

javascript:javascript:(function(){var url = location.href;var title = document.title || url;var desc = '<div class="show">[snap url="'+url+'" w="600px" h="350px" link="on"]'+(window.getSelection ? window.getSelection()+'</div>'.toString() : document.getSelection ? document.getSelection()  : document.selection.createRange().text);'' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&desc=' + encodeURIComponent(desc)+'&client=simplelet#main','_blank','menubar=no,height=580,width=608,toolbar=no,scrollbars=no,status=no');})();

I made an addition here, wrapping the comment field in a div I named “show”. I did this because Diigo puts the tags in the body of what becomes the post. So it looks like below. It was irritating because the tags weren’t in any particular div and there was no other easy way to address the pieces I wanted to vanish. I didn’t like that and since this site was purely set for this workflow I went the other route (a fairly nuclear one). I set .entry-content p to display: none. That vanishes it. Since I’d added the additional div piece for the Diigo comments, that stuff was safe from being vanished.

.entry-content p {
display: none;

Changing the Sorter to Use Snap Previews

The previous child theme was pulling thumbnails from media uploads and was looking for the “attachment” post type.
So I’ll try to delineate the changes to make it use regular posts and use the WordPress Snap thumbnail in lieu of the media attachments.

The old version looked like this.

            $args = array('post_type' => 'attachment', 'posts_per_page' => 35);
            // Get all attachments
            // Change the arguments as you like
            $attachments = get_posts($args);
            if ($attachments) {
              foreach ($attachments as $attachment) {
                $post_id = $attachment->post_parent;
                $post_cat = get_the_category($post_id);
                $post_title = get_the_title($post_id);
                $cat_name = $post_cat[0]->cat_name;
                $cat_slug = $post_cat[0]->slug;

                echo '<li class="mix '.$cat_slug.'">';
                // We are using the category slug to order the images
                echo '<a href="'. wp_get_attachment_url($attachment->ID) .'">';
                // Let's link everything to the full size image URL
                echo wp_get_attachment_image($attachment->ID, 'thumbnail');
                // Display the thumbnail
                echo '<p>';
                echo 'Cat: '. $cat_name .'<br />';
                echo 'Post title: '. $post_title .'<br />';
                echo 'Image: '. apply_filters('the_title', $attachment->post_title);
                echo '</p></a></li>';

Below you can see the modifications I made with attempts to comment on where the difference are and what I did. The main key was dropping references to “parent” that were needed in the previous code and finding out that do_shortcode was a thing. Prior to finding out about that via this Stack Overflow post, I kept getting the code that I wanted but it was wrapped in double quotes (which seemed to magically appear) and that prevented it from working.

            $args = array('post_type' => 'post', 'posts_per_page' => 35); //this focuses the "search" on posts rather than attachments
            // Get all posts
            // Change the arguments as you like
            $posts = get_posts($args); //I changed the variable name from attachments to posts to make things clearer
            if ($posts) {
              foreach ($posts as $post) {
                $post_id = $post; //Previously the code had to look to the parent post for the ID, removed since posts don't have parents
                $post_cat = get_the_category($post_id);
                $post_title = get_the_title($post_id);
                $cat_name = $post_cat[0]->cat_name; //this element pulls the first category tag as the sorting doesn't work well with multiple categories
                $cat_slug = $post_cat[0]->slug;

                echo '<li class="mix '.$cat_slug.'">';
                // We are using the category slug to order the images
                echo '<a href="'. get_permalink ($post->ID) .'">';
                // Links to the post permalink which in this case routes you back out to the source webpage bc of the Diigo/FeedWP interaction
                echo do_shortcode('[snap url="'. get_permalink($post->ID). '" w="150px" h="150px" link="on"]');
                // Notice the do_shortcode piece- that's important or it won't work
                echo '<p>';
                echo $cat_name .'<br />';
                // echo 'Post title: '. $post_title .'<br />';
                echo apply_filters('the_title', $post->post_title);
                echo '</p></a></li>';
                // Display the post category name, the post title, and the image title

Vague Reflections and Recent Quotes That Encourage Me

It is sometimes helpful for me to look at the longterm way I make progress. I like to see how widely separated pieces (in time and subject) eventually come together to create something new. It is comforting to see that time and energy comes back. It’s easy to see many things I do as failures in the moment but those pieces often resurface and recombine with other failures to make something later that I do consider a success. I once thought at some point I’d know where I was headed and would focus my energy accordingly. I’ve actually found that doing the opposite is what has made me the happiest. I try to cultivate, rather than curtail, my interests in diverse topics, to have ‘stacks and stacks’ of both ideas and thoughts and plans. I want to be manically interested and constantly puzzled (just short of required medication).

If you instead say a prayer to the atomic sensation of being puzzled and the catharsis that comes from being unpuzzled, you will never get enough of being puzzled and unpuzzled.

Dan Meyer

It’s also interesting to me to see how long the delay between puzzlement and catharsis can be. That’s something our culture doesn’t spend much time encouraging. A lot of things take time to develop for me, usually followed by lots of rapid action.

The toughest thing to understand as a product designer in a startup is that 99 percent of your ideas will never work or see the light of day. If more than 1 percent of your ideas are making it into the finished product, then you aren’t coming up with enough ideas.

Today I start by asking many questions. And by making sure we have stacks and stacks of ideas for every product and design problem.

How Sketching Spreads Design Thinking

cc licensed ( BY SA ) flickr photo shared by Tom Woodward

One thought on “Catharsis – WP Child Theme Evolution

Comments are closed.