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
<?php | |
$meta_query_args = array( | |
'meta_query' => array( | |
array( | |
'key' => 'my_date_field', | |
'value' => array( '2022-01-01', '2022-12-31' ), | |
'type' => 'date', | |
'compare' => 'BETWEEN' | |
) | |
) |
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
<?php | |
// Increase the image resize threshold to 4000px on the longest edge | |
function smartwp_big_image_size_threshold( $threshold ) { | |
return 4000; | |
} | |
add_filter( 'big_image_size_threshold', 'smartwp_big_image_size_threshold', 999, 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
<?php | |
// Disable WordPress' automatic image scaling feature | |
add_filter( 'big_image_size_threshold', '__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
<?php | |
// Ensure user is logged in | |
if( is_user_logged_in() ) { | |
// Display current logged in user's avatar (includes <img> tag) | |
echo get_avatar( get_current_user_id(), 96 ); | |
// Display current logged in user's avatar URL | |
echo get_avatar_url( get_current_user_id(), array( 'size' => 96 ) ); | |
} |
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
<?php | |
// Display post title using post ID | |
echo get_the_title( 5 ); | |
// Display post title and safely escape value | |
echo esc_html( get_the_title() ); | |
// Using the_title function to automatically echo the title, while you can append or prepend the title using the function as displayed below | |
the_title( 'Before:', ' - After' ) |
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
<?php | |
// Display post title | |
echo get_the_title(); |
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
<?php | |
$url_parts = parse_url( home_url() ); | |
$current_url_with_query_string = $url_parts['scheme'] . "://" . $url_parts['host'] . add_query_arg( NULL, NULL ); | |
echo $current_url_with_query_string; |
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
<?php | |
global $wp; | |
$current_slug = add_query_arg( array(), $wp->request ); | |
echo $current_slug; |