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' ); |
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' ); |
Get post type for custom post types etc:
| PHP | | copy code | | ? |
| 1 | get_post_type( $post->ID ) |
Test for a parent page and get its ID
| PHP | | copy code | | ? |
| 1 | if($post->post_parent){ |
| 2 | $parentID = ($post->post_parent); |
| 3 | } |
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()
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 | ?> |
Go to http://www.yourdomain.com/wp-admin/options.php and edit the fields for:
Go to http://www.yourdomain.com/wp-admin/options.php to view and edit all options in the wp-options table
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
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