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
// Open up your dev tools console and simply paste this in | |
// You can change the different variables to suit your needs | |
// You have to enqueue the script and style, though (see below) | |
jQuery(document).ready(function ($) { | |
var pointerTitle = 'My Pointer Title', | |
pointerContent = 'This is the content of the pointer<br />You can also add Line breaks.', | |
htmlPointerContent = '<h3>' + pointerTitle + '</h3><p>' + pointerContent + '</p>'; | |
// Simply find the selector you want to target |
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 | |
/** | |
* Build an array object out of basic WP_POST info as well as the meta_keys we want | |
* | |
* @param WP_POST $post_object | |
* @param string|array $expected_meta_keys | |
* | |
* @return array | |
*/ | |
public static function prep_my_wp_object( WP_POST $post_object, $expected_meta_keys ) { |
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 | |
/** | |
* selected( $selected, $current, $echo); | |
* | |
* http://codex.wordpress.org/Function_Reference/selected | |
*/ | |
foreach ( $users as $user ) { | |
echo '<option value="' . $user->id . '" ' . selected( $prop_photographe, $user->ID, false ) . '>' . $user->data->display_name . '</option>'; | |
} |
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 | |
/** | |
* Below code could be placed inside your functions.php file | |
* | |
* Below is based on | |
* http://codex.wordpress.org/Plugin_API/Filter_Reference/tiny_mce_before_init | |
* and various places like | |
* https://www.leighton.com/blog/stop-tinymce-in-wordpress-3-x-messing-up-your-html-code | |
* http://redstarwebdevelopment.com/2011/07/15/iframes-in-wordpress/ | |
* http://www.lmhproductions.com/52/wordpress-tincymce-editor-removes-attributes/ |
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
(function ($) { | |
$(document).ready(function () { | |
var icons = { | |
header : "ui-icon-circle-arrow-e", | |
activeHeader: "ui-icon-circle-arrow-s" | |
}, | |
$accordion = $("#accordion"); | |
$accordion.accordion({ |
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 | |
/** | |
* Adds a shortcode column for a CPT | |
* | |
* In this example, my CPT's slug is ISO_SLIDER | |
* | |
* Uses | |
* http://codex.wordpress.org/Plugin_API/Filter_Reference/manage_$post_type_posts_columns | |
* http://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column | |
* |
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
function iso_enqueue_my_awesome_admin_scripts( $hook ) { | |
// First argument is simply to give it a "name". | |
wp_enqueue_script( 'iso-custom-admin-scripts', get_template_directory_uri() . '/iso-admin-scripts.js', array('jquery') ); | |
} | |
add_action( 'admin_enqueue_scripts', 'iso_enqueue_my_awesome_admin_scripts' ); |
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 | |
// In case we need to re-use $prefix somewhere, declaring it here could diminish the chances of a typo | |
$prefix = '_awc_'; | |
// Get the post meta named '_awc_demo' for 'this' post | |
// Post_meta can be saved as an array, adding 'true' at the end will result in fetching only one. | |
// It also means that you don't need to do $entries[0] (index 0 inside $entries) to get what you want | |
$entries = get_post_meta( get_the_ID(), $prefix . 'demo', true ); | |
// get_post_meta could return 'false', or a blank space, or... |