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_url = home_url( add_query_arg( array(), $wp->request ) ); | |
echo $current_url; |
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
@media (prefers-color-scheme: dark) { | |
:root { | |
--contrast: #fff; | |
--contrast-2: #000; | |
--contrast-3: #000; | |
--base: #1e1e1e; | |
--base-2: #212121; | |
--base-3: #212121; | |
--accent: #1e90ff; | |
--global-color-8: rgba(180, 180, 191, 0.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 | |
$meta_query_args = array( | |
'post_type' => 'page', | |
'order' => 'ASC', | |
'meta_key' => 'city_name', | |
'orderby' => 'meta_value' | |
); | |
$meta_query = new WP_Query( $meta_query_args ); |
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( | |
'relation' => 'AND', | |
array( | |
array( | |
'key' => 'city_name', | |
'value' => array('New York City', 'London', 'San Francisco'), | |
'compare' => 'IN' | |
), |
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' => 'city_name', | |
'value' => array('New York City', 'London', 'San Francisco'), | |
'compare' => 'IN' | |
) | |
) | |
); |
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' => 'featured_post', | |
'value' => 'yes', | |
'compare' => '=' | |
) | |
) | |
); |
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 | |
echo 'Returning a specific post ID from a url: '.url_to_postid( 'https://smartwp.com/my-page-url' ); |
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 | |
$post_details = get_page_by_title( 'My Post Title', '', 'post' ); | |
echo $post_details->ID; | |
$page_details = get_page_by_title( 'My Page Title', '', 'page' ); | |
echo $page_details->ID; |
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 | |
$user_data = get_user_by('login', 'someguy'); | |
echo 'The user ID is '.$user_data->ID; |
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 | |
$current_user = wp_get_current_user(); | |
echo 'Username: '.$current_user->user_login; | |
echo 'User ID: '.$current_user->ID; | |
echo 'User Email: '.$current_user->user_email; | |
echo 'User First Name: '.$current_user->user_firstname; | |
echo 'User Last Name: '.$current_user->user_lastname; | |
echo 'User Display Name: '.$current_user->display_name; |