Articles of hooks

Theme not calling Jquery properly

I am developing a theme and I have called jquery along with other JS files from a theme-enqueue.php file. For some reason only the Jquery file that is hosted on googles servers is adding the theme URL into the URL path so it is not loading it and causing other JS files to not load […]

Why enqueue styles on hook?

Why do we need to enqueue styles on a hook, why not just enqueue them straight in like this? wp_enqueue_style( $handle, $src); the codex page gives an example of using a hook but doesn’t explain why (or if) it’s important.

What's the hook for filtering every texts of site?

I’m developing a plugin to replace a character that google doesn’t show it with an accepted character. I want to get all the texts that wordpress returns (content, comments, title, names, etc.) but I don’t know what hook should I use to do it. Can anybody help me?

“admin_enqueue_scripts” hook or $_GET?

When adding a function to “admin_enqueue_scripts” a hook is passed to the function. It looks like this “toplevel_page_nameofyourpage”. That works great, but how is it different from checking the $_GET variable to see which page you are on? Is one preferred over the other? Why? I’m only talking about when you create your own menu, […]

Auto log in hook is requiring a page refresh

I have a simple auto log in hook that looks like the following: function auto_login() { if (!is_user_logged_in()) { //Removed some code for brevity. $user = get_userdatabylogin($domainName); if ($user != null) { //Set the auth cookie. wp_set_auth_cookie($user->ID, false, null); //Set the current user (this will also set WP objects at the global level) wp_set_current_user($user->ID); } […]

Alternative to new_to_publish Hook for Custom Statuses

I am looking for the right hook to use for sending out an email notice when a post is inserted. However, I am using custom statuses (in this case ‘holding’) which doesn’t seem to get hit with the new_to_holding hook, so was hoping someone knew of an alternative that gets fired when a post is […]

How to add style to a string of text throughout WordPress website?

I am building a site for a friend, the site has launched, now he tells me he wants his site name to appear green everywhere it appears on the website. Immediately, I thought of the plugin SEO Smart Links, which automatically links a string of text. Is there anything like this for applying styles or […]

How to pass a special CSS class into widget li

I have assigned a Sidebar into functions.php: register_sidebar( array ( ‘name’ => ‘Footer Widgets Area’, ‘id’ => ‘footer_widgets_area’, ‘description’ => ‘Assign Maximum 3 widgets into this footer sidebar area.’, ‘class’ => ‘my-class’, ‘before_widget’ => ‘<li id=”%1$s” class=”widget-container %2$s”>’, ‘after_widget’ => “</li>”, ‘before_title’ => ‘<h3 class=”widget-title”>’, ‘after_title’ => ‘</h3>’ ) ); In footer I want to […]

WordPress's “Text” Format

When using self-hosted WordPress, you have the option of writing in “Visual” or “Text” mode. Assuming there’s no plugins installed, Is this “Text” format a well defined standard or pseudo standard? (like markdown, textile, etc.) Is there a single place in a plugin-less 3.5.1 WordPress where this text is converted into HTML? If the answer […]

after_setup_theme is called three times

Trying to find an issue with my theme that is not related with this question, I’ve started the debugger and enabled a breakpoint to the first line of a function hooked to after_setup_theme. Here I’ve realized that the function is called three times, before the page is rendered. Is that normal? Isn’t this action supposed […]