Articles of functions

Query function not executed between <div> element

I’m wondering why the following code is not executed between the element it’s put in. I know sort of how to fix, but I’m not sure if that’s the best solution. My code: First function function myfunction1($args = array()) { var_dump($args); $output = null; $output .= ‘<div id=”mydivelement”>’; $output .= myfunction2( $args ); $output .= […]

Return link pages instead of displaying them

Is there any WP function to return the pages links instead of displaying them with wp_link_pages()?

How can I use wp_insert_comment to write a comment when a post is edited?

This would mean that when post A was edited by User1, a new comment would appear under post A that reads ‘edited by User1’, so that the post edit history can easily be seen. A link to the post revision could also be useful here. Perhaps wp_new_comment would be a better choice?

Page Template Won't Load Correct CSS File

I can’t get the correct css file to load for my page template. The page is correctly loading the template but still using the default css file. This is the code I’m using to load the page template’s css file: if (is_page_template(‘page-templates/page-nosidebar.php’)) { wp_enqueue_style(‘authorLuncheon-layout-style’, get_template_directory_uri() . ‘/layouts/no-sidebar.css’); } else { wp_enqueue_style(‘authorLuncheon-layout-style’, get_template_directory_uri() . ‘/layouts/content-sidebar.css’); } […]

Child Theme's Read More Text

I’m sitting here trying to figure out how to change the Read More text. I’m currently creating a Child Theme of Oxygen and as far as I can tell, they don’t have a function to easily change it. I want to change the text without copying over the entire index.php file though this is line […]

wp_get_attachment_image_src returns image on main domain, false on subdomain

I’ve got a multisite install in development where both the subdomains and the main site use the exact same page templates for showing data. However, when I try to get a profile image (added ID in wp_usermeta), I get false on the subdomains, but the actual image data returned on the main domain. I came […]

How to call a custom taxonomy term name inside a function?

With the following function, the content of another page is included into a page template, which is working fine: // add content of another page function show_post($path) { $post = get_page_by_path($path); $content = apply_filters(‘the_content’, $post->post_content); echo $content; } The function is called like this: Now I placed this code inside a custom taxonomy template: taxonomy-$taxonomy-$term.php […]

Function to limit number of custom post types on homepage – TwentyTen

here is the deal… I got hold of this piece of code to change the default post type shown on my TwentyTen child theme’s homepage. It works like a charm when I add this code to the functions.php file, but I would like to also limit the number of posts to 1 (or 2) instead […]

Use Exact Image Size using add_image_size

I have a pretty basic question. It may be very noob question, but it is bothering me a lot. In my theme I’ve added a custom image size like this: function img_update() { if ( function_exists( ‘add_image_size’ ) ) { add_image_size( ‘blog_feat_img’, 720 ); add_image_size( ‘latest_posts_widget_feat_img’, 400 ); add_image_size( ‘portfolio_widget_feat_img_1x’, 400 ); add_image_size( ‘portfolio_widget_feat_img_2x’, 800 […]

Modify function to only return values for the user that’s logged in

I’m trying to modify a function in a plugin so that it only returns the custom post type (venues) of the user that’s logged in (by default it displays all venues). This is my first time customizing a function, so any help would be greatly appreciated! This is what I’ve put into my functions.php file: […]