Skip to content

Instantly share code, notes, and snippets.

<h2><?php echo $home; ?></h2>
// Check if is page-homepage.php template
$post_id = (isset($_GET['post'])) ? $_GET['post'] : ((isset($_POST['post_ID'])) ? $_POST['post_ID'] : false);
if ($post_id) :
$post_template = get_post_meta($post_id, '_wp_page_template', true);
if ($post_template == 'page-homepage.php') {
// Add the Meta Box
function home_custom_meta_box() {
// Add the Meta Box
function home_custom_meta_box() {
add_action('save_post', 'home_save_custom_meta');
}
home_custom_meta_box, home_show_custom_meta_box,
home_custom_meta_fields, and home_save_custom_meta
posts_custom_meta_box, posts_show_custom_meta_box, posts_custom_meta_fields, and posts_save_custom_meta for example.
@WagnerMatos
WagnerMatos / WordPress Conditional Custom Meta Box
Created January 3, 2013 22:32
WordPress Custom Meta Box that can used only on certain post types, pages, etc.
<?php
/*/////////////////////////////////////////////////////////////////////////////////////
//// Load scripts and styles for Meta box */
// enqueue scripts and styles, but only if is_admin
if(is_admin()) {
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('custom-js', get_template_directory_uri().'/library/metaboxes/js/custom-js.js');
wp_enqueue_style('jquery-ui-custom', get_template_directory_uri().'/library/metaboxes/css/jquery-ui-custom.css');
@WagnerMatos
WagnerMatos / .htaccess
Created January 4, 2013 09:04
.htaccess file to fool Drupal 7 in thinking that it is located in the root folder rather than in a subdirectory.
RewriteEngine on
#
# stuff to let through (ignore)
#RewriteCond %{REQUEST_URI} "/folder1/" [OR]
#RewriteCond %{REQUEST_URI} "/folder2/"
RewriteRule (.*) nomad/$1 [L]
module.exports = {
get: function (req, res) {
res.sendfile(req.path.substr(1));
},
_config: {
rest: false,
shortcuts: false
}
};