Making WordPress Admin Bar Work With AngularJS Theme

In my tutorials of AngularJS WordPress theme, I’ve always put ng-app=”app” in html tag. Maybe I haven’t mentioned, but in fact, the ng-app=”app” can go with any HTML tag in your page, as long as it makes sense. For example, it’s obvious the body tag should be the second best place to insert the ng-app=”app” …

Read moreMaking WordPress Admin Bar Work With AngularJS Theme

Using Slug To Get Single Post In AngularJS WordPress Theme

In the first post of my AngularJS WordPress theme series, I set the post title to link to {{post.ID}} so I can get a single post with the default route in WP API: /posts/<id>. Couple days ago Ryan asked me can we use slug instead of ID, and reminded me that in the original demo video (Eric …

Read moreUsing Slug To Get Single Post In AngularJS WordPress Theme

Move page links on top of share buttons in Ryu

Yesterday when I published my thoughts about Freelance Web Developers Market Research, it’s the first time I wrote a 2000-word article on my blog, I thought it was a good idea to add page links to divide it into two pages.

I knew Ryu (the theme I used for this blog) had styled the page links so it should work fine. But later I found the page links showed after three blocks I’ve added with plugins – share buttons, related posts and author box. My visitors might not know there was a second page of that post.

When looked into the code I found the developer used wp_link_pages() under the_content() in content.php, but the plugins I used hooked their code to the end of the_content filter, that’s why the page links would always be displayed after them.

Here are the snippets I added to the child theme of Ryu to solve my problem.

1. Remove the wp_link_pages() from content.php

2. Hook wp_link_pages() to the_content filter in functions.php

Now it works and I’m still amazed that such a beautiful, elegant theme is free on WP.org.

Long Strings Will Break Your Responsive Theme On Mobile

After I switched the theme to Ryu I’m really impressed by the visual design. Until I found the theme kind of broken on my iPhone.

To be honest, it’s not Ryu’s fault, it’s me that use long strings like URL, Linux command …etc.

The solution is super easy if you know you can always find CSS solutions on CSS-Tricks. One of my long time favorite websites hosted by my long time favorite front-end developer Chris Coyier.

Just want to remind myself and other theme developers: Remember to make your beautifully crafted theme “long string safe”. Your users will be very much appreciated that.

Get the right prev/next post link when order posts by menu_order

There are 2 functions in WordPress to let you display previous and next post links: previous_post_link and next_post_link. In general, they work so well and really save a bunch time when coding a theme. Recently in one of my projects, I created several custom post types, and made the posts ordered by menu_order. In such …

Read moreGet the right prev/next post link when order posts by menu_order