RSS

Category Archives: Wordpress

Send emails with multiple attachments using wordpress

// values are just samples…

$to = “$inq_email”;
$subject = “Form Inquiry”;
$headers = ‘From: John Martel ‘ . “\r\n”;
$target_path = array(WP_CONTENT_DIR . ‘/uploads/sample1.pdf’);
array_push($target_path, WP_CONTENT_DIR . ‘/uploads/sample2.zip’);

$message = “

Thank you {$inq_name} for your inquiry and we will contact you as soon as we reviewed your message.

“;

if(wp_mail($to, $subject, $message, $headers, $target_path)) { echo ‘email success’; } else { echo ‘did not send’; }

 
Leave a comment

Posted by on September 25, 2011 in Wordpress

 

Tags: , , , ,

Registering a custom menu on your wordpress theme

// Add this on function.php
add_theme_support( ‘menus’ );
register_nav_menus( array( ‘menu_name’ => __( ‘Menu Description’) ) );

//add this on your theme. example is header.php
wp_nav_menu( array( ‘theme_location’ => ‘menu_name’ ) );

 
Leave a comment

Posted by on September 12, 2011 in Wordpress

 

Tags: , , ,

cat_is_ancestor_of

Returns true if $childcategory is a sub category of $parentcategory

 
Leave a comment

Posted by on August 27, 2011 in Wordpress

 

Get current category id and slug

//Check if the page is a category one and display the current category id and slug..

if ( is_category()) {
$cat = get_query_var(‘cat’);
$currentcat = get_category ($cat);
echo ‘current category id is ‘. $yourcat . ‘
‘;
echo ‘current category slug is ‘. $yourcat->slug
}

 
Leave a comment

Posted by on August 27, 2011 in Wordpress

 

wp_list_categories() exclude by slug name wordpress

<?php

$category = get_category_by_slug(‘uncategorized’);
$catid = $category->term_id;

wp_list_categories(‘orderby=order&title_li=&hide_empty=0&exclude=116,’.$catid);

?>

 
Leave a comment

Posted by on July 7, 2011 in Wordpress

 

Tags: , , ,

Force one column layout for wordpress post area

This will make the wordpress post area default to one column and force current users to use one column layout

//Add this on function.php
function one_screen_column_layout( $columns_width ) {
$columns_width['post'] = 1;
return $columns_width;
}
add_filter( ‘screen_layout_columns’, ‘one_screen_column_layout’ );

function sone_screen_column_layout() {
return 1;
}
add_filter( ‘get_user_option_screen_layout_post’, ‘one_screen_column_layout’ );

 
Leave a comment

Posted by on May 14, 2011 in Wordpress

 

Tags:

Arrange publish box, featured image box, and meta tags box location

You can set this to make the publish box, featured box and tags box arrange on the bottom part of the editor. This is good for creating a one column width post section.

//Add this on the function.php
add_action( ‘add_meta_boxes’, ‘arrange_meta_boxes’, 0 );
function arrange_meta_boxes(){
global $wp_meta_boxes;

remove_meta_box( ‘postimagediv’,'post’,'side’ );
remove_meta_box( ‘submitdiv’,'post’,'side’ );
remove_meta_box( ‘tagsdiv-post_tag’,'post’,'side’ );

add_meta_box(‘new_postimagediv’, __(‘Add Photo’), ‘post_thumbnail_meta_box’, ‘post’, ‘normal’, ‘high’);
add_meta_box( ‘new_tagsdiv-post_tag’, __(‘Tags’), ‘post_tags_meta_box’, ‘post’, ‘normal’, ‘low’);
add_meta_box( ‘new_submitdiv’, __(‘Publish’), ‘post_submit_meta_box’, ‘post’, ‘normal’, ‘low’);
}

 
Leave a comment

Posted by on May 14, 2011 in Wordpress

 

Tags: , , , , ,

 
Follow

Get every new post delivered to your Inbox.