This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!-- | |
/** | |
* Copyright © Magento, Inc. All rights reserved. | |
* See COPYING.txt for license details. | |
*/ | |
--> | |
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | |
<body> | |
<referenceContainer name="columns.top"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//format number to currency | |
function formatCurrency(num) { | |
var p = num.toFixed(2).split("."); | |
return "£" + p[0].split("").reverse().reduce(function(acc, num, i, orig) { | |
return num=="-" ? acc : num + (i && !(i % 3) ? "," : "") + acc; | |
}, "") + "." + p[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Add Comment Next To Featured Image on Post Types | |
// | |
function add_featured_image_display_settings( $content, $post_id ) { | |
global $post; | |
if ($post->post_type != 'post') { | |
$field_id = 'show_featured_image'; | |
$field_value = esc_attr( get_post_meta( $post_id, $field_id, true ) ); | |
$field_text = esc_html__( 'Recommended Size = 400px x 400px', 'generatewp' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Disable support for comments and trackbacks in post types | |
function df_disable_comments_post_types_support() { | |
$post_types = get_post_types(); | |
foreach ($post_types as $post_type) { | |
if(post_type_supports($post_type, 'comments')) { | |
remove_post_type_support($post_type, 'comments'); | |
remove_post_type_support($post_type, 'trackbacks'); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Remove Content Box From Homepage | |
function remove_editor_init() { | |
if ( is_admin() ) { | |
$post_id = 0; | |
if(isset($_GET['post'])) $post_id = $_GET['post']; | |
$posts_without_wysiwyg = array(2, 226); | |
if ( in_array($post_id, $posts_without_wysiwyg)) { | |
remove_post_type_support('page', 'editor'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('show_admin_bar', '__return_false'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Remove Featured Image From Certain Pages | |
function remove_featured_image_init() { | |
if ( is_admin() ) { | |
$post_id = 0; | |
if(isset($_GET['post'])) $post_id = $_GET['post']; | |
$posts_without_featured_image = array(2, 106, 109, 125, 130, 141, 145, 149, 153, 172, 176, 207, 219, 226, 239, 241); | |
if ( in_array($post_id, $posts_without_featured_image)) { | |
remove_post_type_support('page', 'thumbnail'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Remove Posts Post Type | |
function remove_default_post_type() { | |
remove_menu_page('edit.php'); | |
} | |
add_action('admin_menu','remove_default_post_type'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function redirect_unwanted_shop_page(){ | |
if (is_woocommerce('shop')) { | |
wp_redirect( home_url() ); | |
exit; | |
} | |
} | |
add_action('template_redirect','redirect_unwanted_shop_page'); |
NewerOlder