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 if(is_singular('slug-of-post-type')) : | |
global $post; | |
$p_type = get_post_type(get_the_ID()); | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function() { | |
$( ".printfriendly a" ).click(function() { | |
$("#pf-core").load(function() { | |
setTimeout( function () { | |
//console.log( $('#pf-core').contents().find('iframe').contents().find('#pf-print-area') ); |
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 | |
$i = 0; | |
$num = 30; | |
$offset = 30; | |
$cpt = 'rate-plan'; | |
$qty = '1,2,3,4,5,6,7,8,9,10,11,12'; | |
$times = explode(',', $qty); | |
foreach($times as $item) { | |
$i++; |
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 | |
// Get a user Access Token (or Page Token if you're the page admin) | |
// https://developers.facebook.com/tools/explorer/145634995501895/ | |
function get_fb_likes($what) { | |
$token = 'your_token_here'; | |
//delete_transient('cached_fb'); | |
if(false === ( $cached_fb_results = get_transient( 'cached_fb' ))) { | |
$json_url = 'https://graph.facebook.com/v2.5/'.$what.'?fields=likes&access_token='.$token; | |
$json = file_get_contents($json_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
<?php | |
// Display Trash depending on where and who - and for last | |
function trash_action( $actions, $post ) { | |
global $post, $typenow; | |
$user_id = get_current_user_id(); | |
$user_data = get_userdata($user_id); | |
// Can this user see the Trash link? | |
$my_custom_roles_array = array('custom-role-1', 'custom-role-2'); |
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 | |
// Go to All posts by default, not Mine | |
function go_to_all() { | |
global $typenow; | |
// Use this if you need this only on specific post types | |
/*if( 'post' !== $typenow ) | |
return;*/ | |
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
/*DELETE FROM wp_posts; | |
DELETE FROM wp_postmeta;*/ | |
TRUNCATE TABLE wp_posts; | |
TRUNCATE TABLE wp_postmeta; |
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 | |
// Setup Swiper before deploy | |
// http://idangero.us/swiper | |
// Add Slideshow Shortcode for WordPress | |
function slideshow_custom_shortcode($atts, $content = null ) { | |
extract( shortcode_atts( array( | |
'plain_text_url' => 'no' // in case the urls are plain text urls, write yes in the parameter eg. [slideshow plain_text_url="yes"]plain text urls here[/slideshow] | |
), $atts ) ); |
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
<table style="table-layout: fixed;"> | |
<colgroup> | |
<col span="1" style="width: 10%;"> | |
<col span="1" style="width: 10%;"> | |
<col span="1" style="width: 40%;"> | |
<col span="1" style="width: 40%;"> | |
</colgroup> | |
<tbody> |
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 with Visual Composer and an add-on for Slides | |
| | |
| We want to remove the slider from the post content, | |
| while keeping it in the backend post editor VC content, | |
| then place it somewhere else, like the header. | |
| | |
| In our case, the slider always sits at the top of the | |
| post content editor, as first item, in its own row. |
OlderNewer