Skip to content

Instantly share code, notes, and snippets.

@SirDarcanos
SirDarcanos / contact.php
Created February 3, 2017 08:34
contact.php
<h2><?php echo esc_html( 'Contact Us!' ); ?></h2>
<p><?php echo esc_html( 'Do you need any help? Please feel free to contact us from here!' ); ?></p>
<?php echo do_shortcode( 'WRITE HERE YOUR CONTACT FORM 7 SHORTCODE' ); ?>
@SirDarcanos
SirDarcanos / functions.php
Last active December 7, 2023 09:10
Add an Enquiry Form to The My Account Page in WooCommerce
<?php
class WC_Custom_My_Account_Tabs extends WC_Query {
/**
* Adds main filters and actions and inits the endpoints.
*/
public function __construct() {
add_action( 'init', array( $this, 'add_endpoints' ) );
if ( ! is_admin() ) {
add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
class WC_Custom_My_Account_Tabs extends WC_Query {
/**
* Adds main filters and actions and inits the endpoints.
*/
public function __construct() {
add_action( 'init', array( $this, 'add_endpoints' ) );
if ( ! is_admin() ) {
add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
add_filter( 'woocommerce_account_menu_items', array( $this, 'edit_navigation' ) );
/**
* Print a View Comment link in the comments list in the admin.
*
* @param array $actions
* @return array
*/
function custom_view_comment_action( $actions ) {
global $comment;
if ( $comment->comment_type !== '' ) {
.breadcrumbs {
background-color: #f8f8f8;
margin-left: -99em;
margin-right: -99em;
margin-bottom: 4.235801032em;
padding: 1.41575em 99em;
}
.breadcrumbs a {
color: #92969e;
/**
* Prints the Breadcrumb in Storefront using the function by Yoast SEO.
*/
function storefront_yoast_breadcrumb() {
if ( function_exists( 'yoast_breadcrumb' ) && ! is_home() ) {
yoast_breadcrumb( '<nav class="breadcrumbs">','</nav>' );
}
}
add_action( 'storefront_content_top', 'storefront_yoast_breadcrumb' );
/**
* Shows a notice in the admin once the bulk action is completed.
*/
function my_bulk_action_admin_notice() {
if ( ! empty( $_REQUEST['bulk_draft_posts'] ) ) {
$drafts_count = intval( $_REQUEST['bulk_draft_posts'] );
printf(
'<div id="message" class="updated fade">' .
_n( '%s post moved to drafts.', '%s posts moved to drafts.', $drafts_count, 'domain' )
/**
* Handles the bulk action.
*/
function my_bulk_action_handler( $redirect_to, $action, $post_ids ) {
if ( $action !== 'draft_posts' ) {
return $redirect_to;
}
foreach ( $post_ids as $post_id ) {
wp_update_post( array(
/**
* Adds a new item into the Bulk Actions dropdown.
*/
function register_my_bulk_actions( $bulk_actions ) {
$bulk_actions['draft_posts'] = __( 'Move to Draft', 'domain' );
return $bulk_actions;
}
add_filter( 'bulk_actions-edit-post', 'register_my_bulk_actions' );
/**
* Remove the additional CSS section, introduced in 4.7, from the Customizer.
* @param $wp_customize WP_Customize_Manager
*/
function mycustomfunc_remove_css_section( $wp_customize ) {
$user = wp_get_current_user();
if ( $user->ID !== 1 ) {
$wp_customize->remove_section( 'custom_css' );
}