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 redirect to post format links. | |
* | |
*/ | |
function umg_link_format_redirect( $original_template ) { | |
if ( 'link' === get_post_format() ) { | |
//get post meta | |
global $post; | |
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 | |
/** | |
* It adds an element righ after the <body> openning tag | |
* using Bricks builder own action. | |
*/ | |
add_action( 'bricks_body', 'my_body_open_tag', 0 ); | |
function my_body_open_tag() { | |
echo 'my own tag here'; | |
} |
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 | |
/** | |
* Preloading WordPress assets without a plugin. | |
* Change function name to something more unique. | |
* Priority is set to 0 to include as high in the <head> DOM as possible. Change priority if needed. | |
* Use WordPress is_page() to target specific page or is_front_page() to target ONLY homepage as in Option #1 | |
* If asset needs to be preloaded globally use Option #2. | |
* For multiple assets clone the link tag instead of the entire echo block. | |
* Change 'as' attribute accordingly. Values for 'as' can be found here https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as. | |
* Use abolute paths. For external assets paste the url, for internal assets use WordPress functions to construct 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
/** | |
* to exclude field from notification add 'exclude[ID]' option to {all_fields} tag | |
* 'include[ID]' option includes HTML field / Section Break field description / Signature image in notification | |
* see http://www.gravityhelp.com/documentation/page/Merge_Tags for a list of standard options | |
* example: {all_fields:exclude[2,3]} | |
* example: {all_fields:include[6]} | |
* example: {all_fields:include[6],exclude[2,3]} | |
*/ | |
add_filter( 'gform_merge_tag_filter', 'all_fields_extra_options', 11, 5 ); | |
function all_fields_extra_options( $value, $merge_tag, $options, $field, $raw_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 | |
//Unregister post type | |
function delete_post_type(){ | |
unregister_post_type('custom_post_type_name'); | |
} | |
add_action('init','delete_post_type', 100); //priority has to be higher than the register action |
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 | |
/** | |
* Gravity Wiz // Gravity Forms // Limit Submissions Per Time Period (by IP, User, Role, Form URL, or Field Value) | |
* | |
* Limit the number of times a form can be submitted per a specific time period. You modify this limit to apply to | |
* the visitor's IP address, the user's ID, the user's role, a specific form URL, or the value of a specific field. | |
* These "limiters" can be combined to create more complex limitations. | |
* | |
* @version 2.7 | |
* @author David Smith <david@gravitywiz.com> |
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
-- | |
-- BACKUP YOUR DATABASE FIRST AND ALWAYS. | |
-- Replace 'wp_' with your prefix if you changed it. | |
-- | |
-- | |
-- This removes all rows from the wp_postmeta table. | |
-- | |
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots' AND meta_value = 'index,follow'; | |
DELETE FROM wp_postmeta WHERE meta_key = '_yoast_wpseo_meta-robots-noindex' AND meta_value = '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 | |
//Improve admin custom search | |
function custom_search_query( $query ) { | |
$custom_fields = array( | |
// put all the meta fields you want to search for here | |
'meta_field', | |
); | |
$searchterm = $query->query_vars['s']; | |
// we have to remove the 's' parameter from the query, because it will prevent the posts from being found |
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 custom columns to admin page | |
add_filter( 'manage_edit-product_columns', 'show_product_order', 15 ); | |
function show_product_order($columns){ | |
$columns['COLUMN_NAME'] = __( 'LABEL'); //Add this for each new column and change LABEL and COLUMN_NAME | |
return $columns; | |
} | |
//Get Custom Columns values from fields | |
function custom_columns( $column, $post_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 | |
//Add custom filter dropdown to admin for CPT | |
function wpse45436_admin_posts_filter_restrict_manage_posts(){ | |
$type = 'post'; | |
if (isset($_GET['post_type'])) { | |
$type = $_GET['post_type']; | |
} | |
//only add filter to post type you want | |
if ('product' == $type){ |