Author Archives: babbler

Hide Contactform 7 from editor role

In wp-config.php:

 PHP |  copy code |? 
1
/* limit access to contactform 7 */
2
define( 'WPCF7_ADMIN_READ_CAPABILITY', 'manage_options' );
3
define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'manage_options' );

Posted in Contact Form 7 | Leave a comment

Jigoshop Sidebar

  • Register a custom sidebar called sidebar-shop.php
  • Add widgets
  • Shop pages will load this sidebar in place of default
Posted in Jigoshop, Plugins, Wordpress 3 | Leave a comment

Get Post Type

Get post type for custom post types etc:

 PHP |  copy code |? 
1
get_post_type( $post->ID )

Posted in Code, Tips and Tricks, Wordpress 3 | Leave a comment

Get ID of Parent Page

Test for a parent page and get its ID

 PHP |  copy code |? 
1
 if($post->post_parent){
2
 $parentID = ($post->post_parent);
3
}

Posted in Code, Tips and Tricks, Wordpress 3 | Leave a comment

Using Custom Field Data in Header

For example, if a page has a custom field “Metadescription”, this can  be used in the head to show a custom description meta tag:

 PHP |  copy code |? 
1
<meta name="description" content="
2
 <?php echo get_post_meta($post -> ID, "Metadescription", true); ?>
3
 ">

Within the loop inside change $post->ID to get_the_id()

Posted in Babble | Leave a comment

Custom Field to Define Sidebar

Sidebar can be selected according to a custom field on the page:

 PHP |  copy code |? 
1
<?php
2
global $wp_query;
3
$postid = $wp_query->post->ID;
4
$sidebar = get_post_meta($postid, "sidebar", true);
5
get_sidebar($sidebar);
6
wp_reset_query();
7
?>

Posted in Code, Theming, Tips and Tricks, Wordpress 3 | Leave a comment

Change URLs of Shopping Cart, Products Page, Account Page and Transactions page

Go to http://www.yourdomain.com/wp-admin/options.php and edit the fields for:

  • product_list_url
  • shopping_cart_url
  • transact_url
  • user_account_url
Posted in WP Ecommerce | Leave a comment

Edit WordPress Options Table in Admin

Go to http://www.yourdomain.com/wp-admin/options.php to view and edit all options in the wp-options table

Posted in Tips and Tricks, Wordpress 3 | Leave a comment

Category Shortcode

Used to display the products in a given category:

 PHP |  copy code |? 
1
[wpsc_products category_url_name='gold-jewellery']

Name parameter uses the category slug

Posted in WP Ecommerce | Leave a comment

Print Category Description

Within the wpsc category loop:

 PHP |  copy code |? 
1
 <?php wpsc_print_category_description("<div class='catDescription'>", "</div>");   ?>

Parameters are html used to wrap the description

Posted in WP Ecommerce | Leave a comment