Skip to content

Instantly share code, notes, and snippets.

add_action( 'template_redirect','tu_add_elementor_filter', 999 );
function tu_add_elementor_filter() {
if ( in_array( 'elementor-page elementor-page-' . get_the_ID(), get_body_class() ) ) {
add_filter( 'body_class', 'tu_add_elementor_classes' );
add_filter( 'generate_show_title','__return_false' );
}
}
function tu_add_elementor_classes( $classes ) {
$classes[] = 'full-width-content';
/* GeneratePress Header fix for problem break points
Change the 900px value in two places to where you have nav/logo overlap */
@media(min-width:769px) AND (max-width:900px) {
.inside-header {
display: flex;
flex-flow: row wrap;
justify-content: center;
}
#site-navigation {
min-width: 900px;
@mrdavefoy
mrdavefoy / add-size-dropdown.php
Last active April 7, 2018 15:10
Add new image size to Size dropdown
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'content' => __( 'Content' ),
) );
}
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
@mrdavefoy
mrdavefoy / add-image-size.php
Created April 1, 2018 18:05
Add custom image size in WordPress
add_image_size( 'content', '800', '9999', false );
@mrdavefoy
mrdavefoy / conditional.php
Created February 6, 2018 19:43
Conditional code
<?php if ( is_single() ) : ?>
[elementor-template id="556"]
<?php endif; ?>
@mrdavefoy
mrdavefoy / current-year-shortcode.php
Created February 5, 2018 08:56
Current Year Shortcode
function year_shortcode() {
$year = date('Y');
return $year;
}
add_shortcode('year', 'year_shortcode');
@mrdavefoy
mrdavefoy / elementor-full-width-gp.php
Last active October 4, 2018 06:49
Automatically set Elementor pages full width
add_action( 'template_redirect','tu_add_elementor_filter', 999 );
function tu_add_elementor_filter() {
if ( in_array( 'elementor-page elementor-page-' . get_the_ID(), get_body_class() ) ) {
add_filter( 'body_class', 'tu_add_elementor_classes' );
add_filter( 'generate_show_title','__return_false' );
}
}
function tu_add_elementor_classes( $classes ) {
$classes[] = 'full-width-content';
/* Push nav down on desktop */
@media (min-width: 769px) {
.main-navigation {
margin-top: 30px;
}
}
@mrdavefoy
mrdavefoy / subheading-spacing.css
Last active April 11, 2019 13:03
CSS for subheading spacing
/* Subheading spacing */
p + h2,
ul + h2,
ol + h2 {
margin-top: 1.5em;
margin-bottom: 0.5em;
}
@mrdavefoy
mrdavefoy / logo-size-gp.css
Last active January 10, 2018 06:52
Logo size CSS - GeneratePress
/* Site logo size */
.header-image {
width: 310px;
}