This file contains hidden or 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 | |
| /* set the url of the file to sideload - probably be from $_POST or something */ | |
| $url = 'http://domain.com/image.jpg'; | |
| /** | |
| * donwload the url into wordpress | |
| * saved temporarly for now | |
| */ | |
| $tmp = download_url( $url ); |
This file contains hidden or 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
| #301 Redirects for .htaccess | |
| #Redirect a single page: | |
| Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
| #Redirect an entire site: | |
| Redirect 301 / http://www.domain.com/ | |
| #Redirect an entire site to a sub folder | |
| Redirect 301 / http://www.domain.com/subfolder/ |
This file contains hidden or 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 | |
| /** | |
| * Populate ACF select field options with Gravity Forms forms | |
| */ | |
| function acf_populate_gf_forms_ids( $field ) { | |
| if ( class_exists( 'GFFormsModel' ) ) { | |
| $choices = []; | |
| foreach ( \GFFormsModel::get_forms() as $form ) { | |
| $choices[ $form->id ] = $form->title; |
This file contains hidden or 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 | |
| /** | |
| * | |
| * Genrate Slugs from Title or any given string | |
| * | |
| * @param string $str | |
| * @return Slug | |
| * | |
| **/ |
This file contains hidden or 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
| // credit: https://wordpress.stackexchange.com/questions/191918/custom-post-preview-without-saving | |
| // related: https://support.advancedcustomfields.com/forums/topic/preview-solution/ | |
| add_filter( 'preview_post_link', function ( $link ) { | |
| return 'http://domain.com/mobile-preview/?src=' . urlencode($link) . '%26admin_bar=false'; | |
| } ); | |
| -- | |
| (function ($) { |
This file contains hidden or 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 | |
| /* | |
| Based on http://github.com/deliciousbrains/wp-migrate-db-pro-tweaks | |
| */ | |
| class ACF_WP_Migrate_DB_Pro_Tweaks { | |
| function __construct() { | |
| add_filter( 'wpmdb_preserved_options', array( $this, 'preserved_options' ) ); | |
| } |
This file contains hidden or 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
| // create a bookmark and use this code as the URL, you can now toggle the css on/off | |
| // thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3 | |
| javascript: (function() { | |
| var elements = document.body.getElementsByTagName('*'); | |
| var items = []; | |
| for (var i = 0; i < elements.length; i++) { | |
| if (elements[i].innerHTML.indexOf('* { background:#000!important;color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }') != -1) { | |
| items.push(elements[i]); | |
| } | |
| } |
This file contains hidden or 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 | |
| # Register custom post types on the 'init' hook. | |
| add_action( 'init', 'my_register_post_types' ); | |
| /** | |
| * Registers post types needed by the plugin. | |
| * | |
| * @since 1.0.0 | |
| * @access public |
This file contains hidden or 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
| wpse13669_show_all_children( $post_id, $current_level ) { | |
| $children = get_posts( array( | |
| 'post_type' =>'page', | |
| 'posts_per_page' =>-1, | |
| 'post_parent' => $post_id, | |
| 'order_by' => 'title', | |
| 'order' => 'ASC' ) ); | |
| if ( empty($children) ) return; | |
| echo '<ul class="children level-'.$current_level.'-children">'; |