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 a custom image size to your theme, the usage is limited only to your theme | |
add_image_size( 'sidebar-thumb', 120, 120, true ); // Hard Crop Mode | |
add_image_size( 'homepage-thumb', 220, 180 ); // Soft Crop Mode | |
add_image_size( 'singlepost-thumb', 590, 9999 ); // Unlimited Height Mode | |
add_image_size( ‘slide-thumb’, 256, 148, true, array( ‘center’, ‘center’ ) ); // Cropped Center | |
// Make the custom image sizes available for the post author to use within the post content/blocks | |
function lstreng_custom_image_sizes( $size_names ) { | |
$new_sizes = array( | |
'homepage-thumb' => 'Homepage Thumbmail', |
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 | |
/*** | |
* Custom function to extract the src from ACF oEmbed iframe | |
* Example: fn('ls_extract_oembed_url', item.youtube_video) | |
**/ | |
function ls_extract_oembed_url($string){ | |
preg_match('/src="(.+?)"/', $string, $match); | |
$url = null; | |
if(isset($match[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 | |
/** | |
* Function to update all Gravity Forms 'State' dropdown field (based on field id #6), from full state name values to abbreviated state values if logged into the site. | |
* Use once, then remove the code. | |
*/ | |
function lstreng_update_all_gravity_forms() { | |
// only load for admin panel | |
if ( is_admin() ) { | |
// load all forms | |
$forms = GFAPI::get_forms(); |
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 | |
function lstreng_author_any_post_types $query ) { | |
// apply changes only for author archive page | |
if ( ! is_author() || ! $query->is_main_query() ) | |
return; | |
$query->set('post_type', 'any'); | |
} | |
add_action( 'pre_get_posts', 'lstreng_author_any_post_types' ); |
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 | |
/* | |
Plugin Name: Deactivate Plugins Locally | |
Description: Deactivate specific plugins on your local environment if defined in a wp-config-local.php file. | |
Version: 1.0 | |
*/ | |
require_once(ABSPATH . 'wp-admin/includes/plugin.php'); | |
if ( defined( 'LOCAL_DISABLED_PLUGINS' ) ) { // If defined in wp-config-local.php | |
$plugins_to_disable = unserialize( LOCAL_DISABLED_PLUGINS ); |
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 | |
// Example: Query to show pages that have a meta_value that contains a string (not exact) | |
// https://rudrastyh.com/wordpress/meta_query.html | |
$args = array( | |
'post_type' => 'page', | |
'meta_query' => array( | |
array( | |
'value' => '[contact-form-7 id="13127" title="Alliance', | |
'compare' => 'LIKE' | |
) |
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 | |
$args = array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
'post_status' => 'publish', | |
'meta_query' => array( | |
array( | |
'key' => '_wp_page_template', | |
'value' => 'template-parts/full-width.php' // Update the value to the page template of your choosing. | |
) |
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 | |
// https://www.advancedcustomfields.com/resources/acfload_field/ | |
// Create your ACF select field & get it's key for use below. | |
add_filter('acf/load_field/key=field_5e4972aa1335c', function( $field ){ | |
// Where new values will live | |
$field['choices'] = array(); | |
// Dynamic data we want to populate with | |
// Ninja Forms - https://developer.ninjaforms.com/codex/settings/ | |
// Get array of all forms |
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 | |
// Ninja Forms - https://developer.ninjaforms.com/codex/settings/ | |
// Get array of all forms | |
$ninja_forms = Ninja_Forms()->form()->get_forms(); | |
foreach ( $ninja_forms as $form ) { | |
// Get the form ID | |
$form_id = $form->get_id(); | |
// Get the form Title | |
$form_name = $form->get_setting( '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 | |
/** | |
* The template for displaying archive pages | |
*/ | |
get_header(); | |
global $wp_query; | |
?> | |
<form id="misha_filters" action="#"> |
NewerOlder