How do I attach an invoice PDF to an email in the Dukapress plugin for WordPress?

function dpsc_pnj_send_mail($to, $from, $name, $subject, $msg, $attachment = FALSE) { global $wpdb; $headers=”MIME-Version: 1.0″ . “\r\n”; $headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”; $headers .= ‘From: ‘ . $name . ‘ ‘ . $from . ” . “\r\n”; if ($attachment) { if ($dp_shopping_cart_settings[‘dp_shop_pdf_generation’] === ‘checked’) { $mail_attachment = array(DP_PLUGIN_DIR. ‘/pdf/invoice_’ . $attachment . ‘.pdf’); @wp_mail($to, … Read more

Hard-coding a shortcode as the last menu item in primary navigation?

add_filter(‘wp_nav_menu_items’,’my_item’, 10, 2); function my_item($items, $args) { $items .= ‘<li class=”myclass”>whatever</li>’; return $items; } If you have a specific theme location for menu you can target it with : if( $args->theme_location == ‘mylocation’ ) EDIT I you can try $items .= ‘<li class=”myclass”>’ . echo do_shortcode(‘[shopping_cart]’) . ‘</li>’; but it will work only if the … Read more

the_post(); prints out style text into my HTML?

You can view the actions and filters being used in your plugins and themes. I’m assuming something is hooked into the_post action somewhere. Dumping the following globals give you a peek behind the curtain here. global $wp_actions, $wp_filters; Once you identify the source, you either queue up the CSS properly in the HEAD, or remove … Read more

Use of antispambot with $curauth->email

As the Codex states for the antispambot() function: Return Values (string) Converted email address. You have to do one of the following: echo antispambot( $curauth->publicemail ); // OR… print antispambot( $curauth->publicemail ); So your full example would look like the following: if ( ! empty( $curauth->publicemail ) ) { echo ‘Email <a href=”https://wordpress.stackexchange.com/questions/43732/mailto:”.antispambot( $curauth->publicemail ).’?subject=Webmail”> … Read more

Functions.php and includes

Many theme frameworks and complex themes break up functions into different files and include them in one file called functions.php, sometimes within a folder called inc. If it’s your own theme, you can pretty much do what you want. If it’s a theme to be released, end users typically look for a functions.php file as … Read more

Pagination Not Working (pages duplicating content)

This is because query_posts resets the query. See this warning on the Codex page: Pagination won’t work correctly, unless you use query_posts() in a page template and you set the ‘paged’ query var appropriately: http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html The call: query_posts( ‘category_name=category&showposts=2′); does not tell it which page to get (so it gets the first page). It’s a … Read more

Add class to every other posts using get_posts

A simple solution would be to add an alternating class to every other post in the list. In particular, (in your style.css) style the list elements <li> in one particular way, and then over-ride that style for list elements of a particular class <li class=”my-alternate-class”>. The class my-alternate-cass will applied to every other list element: … Read more

WordPress doesn’t load HTML

I changed the way I went about this and did this to solve it: $page = get_page( $menu->object_id ); $output .= apply_filters( ‘the_content’, $page->post_content ); My information now shows up correctly.

Pagination not working

See Pagination Parameters under WP_Query in Codex: Since WordPress 3.0.2, you do get_query_var( ‘page’ ) instead of get_query_var( ‘paged’ ). The pagination parameter ‘paged’ for WP_Query() remains the same.

Customize Buddypress adminbar [closed]

First, you may want to consider using the WP toolbar (which features full BP integration), because the BP BuddyBar will not continue to be supported in future versions of BP. (It will probably still work, but it won’t be actively upgraded.) Flip the Toolbar on by putting define( ‘BP_USE_WP_ADMIN_BAR’, true ); into your wp-config.php file. … Read more