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 | |
/** | |
* Some example snippets for the control of notices in WordPress admin panel | |
* | |
* @package PCianes\AdminUtilities | |
* @since 1.0.0 | |
* @author PCianes | |
* @license GNU General Public License 2.0+ | |
*/ | |
namespace PCianes\AdminUtilities; |
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 | |
/** | |
* Some snippets for the control of strings | |
* | |
* @package PCianes\StringsUtilities | |
* @since 1.0.0 | |
* @author PCianes | |
* @license GNU General Public License 2.0+ | |
*/ |
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 | |
/** | |
* Change the read more link -> post.php | |
* | |
* @package PCianes\GenesisUtilities | |
* @since 1.0.0 | |
* @author Pablo Cianes | |
* @license GNU General Public License 2.0+ | |
*/ |
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
// Native CSS breakpoint | |
@media screen and (max-width: 1023px) { | |
// styles | |
} | |
// Device size breakpoint | |
@media screen and (max-width: $screen-size--medium) { | |
// styles | |
} |
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 | |
namespace PCianes; | |
// use str_replace all the time instead of Regex instructions. | |
add_filter( 'the_content', __NAMESPACE__ . '\filter_the_content', 99 ); | |
function filter_the_content( $content ) { | |
$encoding = 'UTF-8'; | |
$needle = 'verlängert'; |
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 | |
/** | |
* Description | |
* | |
* @package ${NAMESPACE} | |
* @since 1.0.0 | |
* @author hellofromTonya | |
* @link https://KnowTheCode.io | |
* @license GNU-2.0+ | |
*/ |
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 Blueprint | |
* | |
* @package PCianes\OOPSandbox | |
* @since 1.0.0 | |
* @author Pablo Cianes | |
* @link https://pablocianes.com | |
* @license GNU-2.0+ | |
*/ |
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 SQL Get a custom field | |
SELECT meta_value | |
FROM wp_postmeta | |
WHERE post_id IN (8) AND meta_key = 'subtitle'; | |
add_action( 'genesis_entry_header', 'pc_render_the_subtitle', 11 ); | |
function pc_render_the_subtitle() { | |
$subtitle = get_post_meta( get_the_ID(), 'subtitle', true ); | |
if ( ! $subtitle ) { |
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('display_post_states', 'pc_custom_post_states', 10 , 2); | |
function pc_custom_post_states($states, $post) { | |
if( ('page'==get_post_type($post->ID)) && ('page-templates/custom-page-template.php'==get_page_template_slug($post->ID)) ) { | |
$states[] = __('Custom state'); | |
} | |
return $states; | |
} |
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 1 | |
function add_cap_upload_files_to_user_id() { | |
$user = new WP_User( $user_id ); | |
$user->add_cap( 'upload_files' ); | |
} | |
add_action( 'admin_init', 'add_cap_upload_files_to_user_id'); | |
// Example 2 | |
function allow_contrib_upload() { |
OlderNewer