Skip to content

Instantly share code, notes, and snippets.

@WPDevHQ
WPDevHQ / gutenberg-locked-warning.md
Created August 3, 2017 18:22
Warning on locked content in Gutenberg.

#BuiltWithGutenberg!

Nore WordPress Theme!

@WPDevHQ
WPDevHQ / custom-menu-widget.css
Created August 1, 2017 05:15
Horizontal aligned menu via the WordPress custom menu widget
/*
* Footem Custom Menu Widget
*/
#footer-menu-widget {
padding: 1% 0;
background-color: transparent;
color: #294e6b;
}
#footer-menu-widget h2.widget-title {
<?php
function gp_child_scripts() {
wp_enqueue_style( 'gpchild-custom-css', get_theme_file_uri( '/customCss/modalStyling.css' ) );
wp_enqueue_script( 'gpchild-custom-js', get_theme_file_uri( '/js/modalScript.js' ), array(), '4.8', true );
}
add_action( 'wp_enqueue_scripts', 'gp_child_scripts' );
<?php
add_action('wp_head', 'webworks_facebook_analytics');
function webworks_facebook_analytics() {
if(current_user_can('manage_options')) {
return;
}
?>
@WPDevHQ
WPDevHQ / Contract Killer 3.md
Created March 19, 2017 14:12 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@WPDevHQ
WPDevHQ / wp_localize_script
Last active February 20, 2017 07:54
wp-localize-script.txt
// In the case of a theme this goes in functions.php and for plugins I use plugin.php :)
function frontend_assets(){
// Enqueue your assets here and add your localization like so!
wp_localize_script( $this->ssp_plugin_slug, 'ss_panel', array(
'success' => __( 'Here are your search results!', 'textdomain' ),
'failure' => __( 'Sorry, no results matched your search query. Try searching again?', 'textdomain' ),
));
}
add_action( 'wp_enqueue_scripts', 'frontend_assets' );
@WPDevHQ
WPDevHQ / custom-functions.php
Last active December 7, 2017 12:28
Keep accordion closed on page load
<?php // Leave this out if you already have an opening php tag in your file!
function elementor_accordion_title() { ?>
<script>
jQuery(document).ready(function() {
jQuery('.elementor-accordion-title').removeClass('active');
jQuery('.elementor-accordion-content').css('display', 'none');
});
</script>
<?php }
add_action( 'wp_footer', 'elementor_accordion_title' );
@WPDevHQ
WPDevHQ / menu-options.php
Last active January 16, 2017 08:10
Show standard or humburger menu on desktop depending on user selection in customizer
<?php
if ( get_theme_mod( 'menu-style' ) == A ) {
//Output standard menu
$handle = 'themeprefix-style';
$menu_style = '.main-navigation{ display: block; } .menu-toggle{ display: none; } ';
wp_add_inline_style( $handle, $menu_style );
} else {
//Output mobile menu
@WPDevHQ
WPDevHQ / replacement-url.php
Last active December 30, 2020 16:41
Replace WooCommerce product link in shop with a custom product page url
<?php
add_action( 'woocommerce_product_options_advanced', 'woostore_elementor_product_link' );
function woostore_elementor_product_link() {
global $woocommerce, $post;
echo '<div class="options_group">';
woocommerce_wp_text_input(
array(
/**
* Redirect to a specific page when clicking on Continue Shopping in the single product page
*
* @return void
*/
function wc_custom_redirect_continue_shopping( $message ) {
if ( strpos( $message, __( 'View Cart', 'woocommerce' ) ) !== false ) {
$message = str_replace( esc_url( wc_get_page_permalink( 'cart' ) ), esc_url( wc_get_page_permalink( 'shop' ) ), $message );
$message = str_replace( __( 'View Cart', 'woocommerce' ), esc_html__( 'Continue Shopping', 'woocommerce' ), $message );