Skip to content

Instantly share code, notes, and snippets.

View denishvachhani's full-sized avatar
🏠
Working from home

Denish denishvachhani

🏠
Working from home
View GitHub Profile
@denishvachhani
denishvachhani / template.php
Last active December 19, 2015 22:19
Get page content, at any place of theme/plugins
<?php
$id=47; // Id of your Page/Post/CustomPost type
$post = get_page($id);
$content = apply_filters('the_content', $post->post_content);
echo $content;
?>
@denishvachhani
denishvachhani / function.php
Created June 12, 2013 13:35
Disable/Hide Certain Payment method like ( cod, paypal, etc..) for certain country.
<?php
// Note for %payment-code%
// CashonDeliver = 'cod'
// PayPal = 'paypal'
// Basic Payment = 'bacs'
// Cheque payment = 'cheque'
// Mijireh Gatway = 'mijireh_checkout'
// Note for %countrycode%
// India = 'IN'
@denishvachhani
denishvachhani / function.php
Last active December 18, 2015 08:49
Use Google font in Genesis Child Theme
<?php
//* Load Marmelad Google fonts
add_action( 'wp_enqueue_scripts', 'custom_load_google_fonts' );
function custom_load_google_fonts() {
wp_enqueue_style( 'google-font', 'http://fonts.googleapis.com/css?family=Marmelad', array(), PARENT_THEME_VERSION );
}
?>
@denishvachhani
denishvachhani / function.php
Last active December 18, 2015 08:48
Remove “Add New” link from custom post type
<?php
function remove_submenus() {
if(!current_user_can('activate_plugins')) {
global $submenu;
unset($submenu['edit.php?post_type=your_custom_post-type'][10]); // Removes 'Add New'.
}
}
add_action('admin_menu', 'remove_submenus');
function hide_that_stuff() {