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 | |
add_action( 'pre_get_posts', 'fpl_maybe_alter_main_query' ); | |
function fpl_maybe_alter_main_query( $query ) { | |
//only perform this action on the main query on the frontend | |
if ( $query->is_main_query() && ( ! is_admin() ) ) { | |
//only do this for logged in users | |
if ( is_user_logged_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
add_filter( 'the_content', 'cv_the_content_filter' ); | |
function cv_the_content_filter( $content ) { | |
$can_user_watch_videos = cv_can_user_watch_videos(); | |
if ( $can_user_watch_videos !== true ) { | |
$content = $can_user_watch_videos; | |
} |
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 | |
//Add this code below to your functions.php, replace 'name-of-tag' and 'value-of-tag' | |
add_action( 'wp_head', 'my_meta_tags' ); | |
function my_meta_tags() { | |
?> | |
<meta name="name-of-tag" content="value-of-tag"> | |
<?php | |
} |
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 | |
if ( stristr( $_SERVER['SERVER_NAME'], 'development' ) ) { | |
// ** MySQL settings DEVELOPMENT ** // | |
define( 'DB_NAME', 'projectname_dev' ); // The name of the database | |
define( 'DB_USER', 'projectname_dev_user' ); // Your MySQL username | |
define( 'DB_PASSWORD', '12345' ); // ...and a password an idiot would have on his luggage | |
define( 'DB_HOST', 'localhost' ); // 99% chance you won't need to change this value | |
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 | |
if ( stristr( $_SERVER['SERVER_NAME'], 'development' ) ) { | |
// ** MySQL settings DEVELOPMENT ** // | |
define( 'DB_NAME', 'projectname_dev' ); | |
define( 'DB_USER', 'projectname_dev_user' ); | |
define( 'DB_PASSWORD', '*****' ); | |
define( 'DB_HOST', 'localhost' ); | |
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 | |
add_filter( 'embed_oembed_html', 'my_embed_filter', 10, 3 ); | |
/** | |
* function for filter 'embed_oembed_html' it echo's a iframe-tag with it's src empty. the src is kept in data-src so javascript can put in the src-attr on a later moment. (e.g. after a cookie-check) | |
* | |
* @author Floris P. Lof | |
* @params String $html the ready made html received from an external API (like Twitter, Youtube, Vimeo) | |
* @params String $url the original URI with WP's oEmbed called the external API | |
* @params Array $attr extra attributes (width height) |
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 | |
add_filter( 'script_loader_src', 'my_script_loader_filter' ); | |
/** | |
* function for filter 'script_loader_src' it echo's a script-tag with it's src empty. the src is kept in data-src so javascript can put in the src-attr on a later moment. (e.g. after a cookie-check) | |
* | |
* @author Floris P. Lof | |
* @params String $src the current source of the scriptfile to be included | |
* @return Boolean false | |
*/ |
NewerOlder