/**
  * Enqueue admin scripts & styles
  */
 function enqueueScripts()
 {
     if (get_post_type() == 'wpdmpro' || in_array(wpdm_query_var('page'), array('settings', 'emails', 'wpdm-stats', 'templates', 'importable-files', 'wpdm-addons', 'orders', 'pp-license'))) {
         wp_enqueue_script('jquery');
         wp_enqueue_script('jquery-form');
         wp_enqueue_script('jquery-ui-core');
         wp_enqueue_script('jquery-ui-tabs');
         wp_enqueue_script('jquery-ui-datepicker');
         wp_enqueue_script('jquery-ui-slider');
         wp_enqueue_script('jquery-ui-sortable');
         wp_enqueue_script('jquery-ui-timepicker', WPDM_BASE_URL . 'assets/js/jquery-ui-timepicker-addon.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-slider'));
         wp_enqueue_style('icons', plugins_url() . '/download-manager/assets/css/icons.css');
         wp_enqueue_script('thickbox');
         wp_enqueue_style('thickbox');
         wp_enqueue_script('media-upload');
         wp_enqueue_media();
         wp_enqueue_script('jquery-choosen', plugins_url('/download-manager/assets/js/chosen.jquery.min.js'), array('jquery'));
         wp_enqueue_style('choosen-css', plugins_url('/download-manager/assets/css/chosen.css'));
         wp_enqueue_style('jqui-css', plugins_url('/download-manager/assets/jqui/theme/jquery-ui.css'));
         wp_enqueue_script('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/js/bootstrap.min.js'), array('jquery'));
         wp_enqueue_script('wpdm-admin', plugins_url('/download-manager/assets/js/wpdm-admin.js'), array('jquery'));
         wp_enqueue_style('font-awesome', WPDM_BASE_URL . 'assets/font-awesome/css/font-awesome.min.css');
         wp_enqueue_style('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/css/bootstrap.css'));
         wp_enqueue_style('wpdm-bootstrap-theme', plugins_url('/download-manager/assets/bootstrap/css/bootstrap-theme.min.css'));
         wp_enqueue_style('wpdm-admin-styles', plugins_url('/download-manager/assets/css/admin-styles.css'));
     }
 }
 function wa_meta_delete_post($post_id)
 {
     if (get_post_type($post_id) == 'shop_order') {
         global $wpdb;
         $wpdb->query($wpdb->prepare("\n\t\t\t\t\tDELETE FROM " . $wpdb->prefix . "wa_product_orders\n\t\t\t\t\tWHERE       order_id = %d\n\t\t\t\t", $post_id));
     }
 }
Example #3
0
 function the_quiz_button($button, $quiz_id)
 {
     global $post;
     $quiz_id = get_the_ID();
     $user_id = get_current_user_id();
     $flag = 1;
     if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $pid = get_post_meta($quiz_id, 'vibe_quiz_product', true);
         if (isset($pid) && is_numeric($pid) && get_post_type($pid) == 'product') {
             $product_taken = wc_customer_bought_product('', $user_id, $pid);
             if (!$product_taken) {
                 $pid = get_permalink($pid);
                 $check = vibe_get_option('direct_checkout');
                 $check = intval($check);
                 if (isset($check) && $check) {
                     $pid .= '?redirect';
                 }
                 $flag = 0;
                 $html = '<a href="' . $pid . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
             } else {
                 $flag = 1;
             }
         }
     }
     if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_user_logged_in()) {
         $membership_ids = vibe_sanitize(get_post_meta($quiz_id, 'vibe_quiz_membership', false));
         if (!pmpro_hasMembershipLevel($membership_ids, $user_id) && isset($membership_ids) && count($membership_ids) >= 1) {
             $membership_taken = get_user_meta($user_id, $quiz_id, true);
             if (!$membership_taken) {
                 $pmpro_levels_page_id = get_option('pmpro_levels_page_id');
                 $link = get_permalink($pmpro_levels_page_id);
                 $html = '<a href="' . $link . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
                 $flag = 0;
             } else {
                 $flag = 1;
             }
         }
     }
     if (in_array('wplms-mycred-addon/wplms-mycred-addon.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $points = get_post_meta($quiz_id, 'vibe_quiz_mycred_points', true);
         $mycred = mycred();
         $balance = $mycred->get_users_cred($user_id);
         if ($balance < $points) {
             $flag = 0;
             $html = '<a href="#"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '<span>' . __('<br/>Not enough points.', 'vibe') . '</span></a>';
         }
         if (!$mycred->has_entry('purchase_quiz', $quiz_id, $user_id)) {
             $flag = 1;
             $deduct = -1 * $points;
             $mycred->update_users_balance($user_id, $deduct);
             $mycred->add_to_log('purchase_quiz', $user_id, $deduct, __('Student subscibed to quiz', 'wplms-mycred'), $quiz_id);
         } else {
             $flag = 1;
         }
     }
     if (!$flag) {
         return $html;
     }
     return $button;
 }
Example #4
0
 function widget($args, $instance)
 {
     global $yarpp;
     if (!is_singular()) {
         return;
     }
     extract($args);
     // compatibility with pre-3.5 settings:
     if (isset($instance['use_template'])) {
         $instance['template'] = $instance['use_template'] ? $instance['template_file'] : false;
     }
     if ($yarpp->get_option('cross_relate')) {
         $instance['post_type'] = $yarpp->get_post_types();
     } else {
         if ('page' == get_post_type()) {
             $instance['post_type'] = array('page');
         } else {
             $instance['post_type'] = array('post');
         }
     }
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     if (!$instance['template']) {
         echo $before_title;
         echo $title;
         echo $after_title;
     }
     $instance['domain'] = 'widget';
     $yarpp->display_related(null, $instance, true);
     echo $after_widget;
 }
Example #5
0
 function vw_render_categories($classes = '')
 {
     $categories = get_the_category();
     $html = '';
     if (is_sticky()) {
         $html .= '<div class="label label-sticky ' . $classes . '" title="' . __('Sticky Post', 'envirra') . '"><i class="icon-entypo-megaphone"></i></div>';
     }
     if ('post' == get_post_type()) {
         if ('1' == get_post_meta(get_the_id(), 'vw_enable_review', true)) {
             $avg_score = get_post_meta(get_the_id(), 'vw_review_average_score', true);
             $html .= '<div class="label label-review ' . $classes . '" title="' . __('Classificação', 'envirra') . '"><i class="icon-entypo-star"></i> ' . $avg_score . '</div>';
         } else {
             // Show post format if not a review
             if ('gallery' == get_post_format()) {
                 $html .= '<div class="label label-light ' . $classes . '" title="' . __('Gallery Post', 'envirra') . '"><i class="icon-entypo-picture"></i></div>';
             } else {
                 if ('video' == get_post_format()) {
                     $html .= '<div class="label label-light ' . $classes . '" title="' . __('Video Post', 'envirra') . '"><i class="icon-entypo-play"></i></div>';
                 } else {
                     if ('audio' == get_post_format()) {
                         $html .= '<div class="label label-light ' . $classes . '" title="' . __('Audio Post', 'envirra') . '"><i class="icon-entypo-note-beamed"></i></div>';
                     }
                 }
             }
         }
     }
     if ($categories) {
         foreach ($categories as $category) {
             $html .= '<a class="label ' . $classes . '" href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("Ver Artigos na Categoria %s", 'envirra'), $category->name)) . '" rel="category">' . $category->cat_name . '</a>';
         }
     }
     echo $html;
 }
 function woocommerce_order_get_items($items)
 {
     if (isset($_GET['post']) && get_post_type($_GET['post']) == 'shop_order') {
         global $sitepress_settings;
         foreach ($items as $index => $item) {
             foreach ($item as $key => $item_data) {
                 if ($key == 'product_id') {
                     $tr_product_id = apply_filters('translate_object_id', $item_data, 'product', false, $sitepress_settings['admin_default_language']);
                     if (!is_null($tr_product_id)) {
                         $items[$index][$key] = $tr_product_id;
                         $items[$index]['name'] = get_the_title($tr_product_id);
                     }
                 }
                 if ($key == 'variation_id') {
                     $tr_variation_id = apply_filters('translate_object_id', $item_data, 'product_variation', false, $sitepress_settings['admin_default_language']);
                     if (!is_null($tr_variation_id)) {
                         $items[$index][$key] = $tr_variation_id;
                     }
                 }
                 if (substr($key, 0, 3) == 'pa_') {
                     global $wpdb, $woocommerce_wpml;
                     //attr is taxonomy
                     $term_id = $woocommerce_wpml->products->wcml_get_term_id_by_slug($key, $item_data);
                     $tr_id = apply_filters('translate_object_id', $term_id, $key, false, $sitepress_settings['admin_default_language']);
                     if (!is_null($tr_id)) {
                         $translated_slug = $wpdb->get_var($wpdb->prepare("\r\n                                    SELECT t.slug FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $key));
                         $items[$index][$key] = $translated_slug;
                     }
                 }
             }
         }
     }
     return $items;
 }
Example #7
0
function load_main_scripts()
{
    wp_register_script('scripts', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), filemtime(get_template_directory() . '/assets/js/scripts.js'), true);
    // Loads in the footer with cache busting
    wp_register_script('collapsible', get_template_directory_uri() . '/assets/js/jquery.collapsible.min.js', array('jquery'), 1.0, true);
    wp_register_script('modernizer', get_template_directory_uri() . '/assets/js/modernizr-2.6.1-respond-1.1.0.min.js');
    wp_register_script('magnific', get_template_directory_uri() . '/assets/js/jquery.magnific.min.js', array('jquery'));
    wp_register_script('select', get_template_directory_uri() . '/assets/js/bootstrap-select.min.js', array('jquery'));
    wp_register_script('dropdown', get_template_directory_uri() . '/assets/js/bootstrap-dropdown.js', array('jquery'), 1.0, true);
    wp_register_script('fitvids', get_template_directory_uri() . '/assets/js/jquery.fitvids.js', array('jquery'), 1.0, true);
    wp_register_script('tabaccord', get_template_directory_uri() . '/assets/js/easyResponsiveTabs.js', array('jquery'), 1.0, true);
    //wp_register_script( 'placeholders', get_template_directory_uri() . '/assets/js/Placeholders.js', array( 'jquery' ), 1.0, true  );
    //wp_register_script( 'glossary', get_template_directory_uri() . '/assets/js/jquery.zglossary.min.js', array( 'jquery' ), 1.0, true  );
    wp_enqueue_script('modernizer');
    wp_enqueue_script('scripts');
    wp_enqueue_script('select');
    wp_enqueue_script('dropdown');
    wp_enqueue_script('magnific');
    wp_enqueue_script('fitvids');
    //wp_enqueue_script( 'placeholders' );
    wp_enqueue_script('tabaccord');
    if (is_page() or get_post_type() == 'state' or get_post_type() == 'faq') {
        wp_enqueue_script('collapsible');
    }
    if (!is_front_page() or !is_post_type_archive('glossary')) {
        wp_enqueue_script('glossary');
    }
    if (is_page_template('page-templates/template-video-gallery.php')) {
        // load only on video gallery
        wp_enqueue_script('lazyYT', get_template_directory_uri() . '/assets/js/lazyYT.js', array('jquery'), 1.0, true);
        // lazy load youtube
    }
}
 function sync_post_module_custom_data($custom_data, $post)
 {
     if (post_type_supports(get_post_type($post), 'publicize')) {
         $custom_data['cpt_publicizeable'] = true;
     }
     return $custom_data;
 }
Example #9
0
 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function ushipnetwork_entry_footer()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         $byline = sprintf(esc_html_x('by %s', 'post author', 'ushipnetwork'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
         echo '<div class="byline">' . '<div class="authorship">' . $byline . '</div>' . '<div class="share">';
         include "share.php";
         echo '</div>' . '</div>';
         $posttags = get_the_tags();
         $count = 0;
         $separator = ', ';
         $output = '';
         if (!empty($posttags)) {
             echo '<span class="tag-list">tags: ';
             foreach ($posttags as $posttag) {
                 $count++;
                 if ($count <= 2) {
                     $output .= '<a href="' . esc_url(get_tag_link($posttag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $posttag->name)) . '">' . esc_html($posttag->name) . '</a>' . $separator;
                 }
             }
             echo trim($output, $separator);
         }
         echo '</span>';
     }
     edit_post_link(sprintf(esc_html__('Edit %s', 'ushipnetwork'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
 }
 /**
  * Trash hook - make sure child pages of trashed page are visible
  */
 public function trashHook($post_id)
 {
     $post_type = get_post_type($post_id);
     if ($post_type == 'page') {
         $this->resetToggles($post_id);
     }
 }
/**
 * @link http://www.ukm.my/template
 *
 * @package WordPress
 * @subpackage ukmtheme
 * @since 4.0
 *
 * @author Jamaludin Rajalu
 *
 * Custom Post Type: Publication
 */
function title_publication_input($title)
{
    if (get_post_type() == 'publication') {
        $title = __('Enter publication name here', 'ukmtheme');
    }
    return $title;
}
Example #12
0
/**
 * Displays meta information for a post
 * @return void
 */
function appletree_post_meta()
{
    if (get_post_type() == 'post') {
        echo sprintf(__('Posted %s in %s%s by %s. ', 'appletreesg.com'), get_the_time(get_option('date_format')), get_the_category_list(', '), get_the_tag_list(__(', <b>Tags</b>: ', 'appletreesg.com'), ', '), get_the_author_link());
    }
    edit_post_link(__(' (edit)', 'appletreesg.com'), '<span class="edit-link">', '</span>');
}
Example #13
0
function kkthemes_archive_title()
{
    $tag_style = '';
    $header_image = get_header_image();
    if (!empty($header_image)) {
        $tag_style = 'background-image: url(' . esc_url($header_image) . ');';
    }
    ?>
	<div class="uk-panel uk-panel-box uk-panel-space uk-text-large uk-text-center tm-branded-panel uk-margin-large-bottom" style="<?php 
    echo $tag_style;
    ?>
">
		<h1 class="uk-article-title" itemprop="headline">
			<?php 
    single_cat_title('') || post_type_archive_title('');
    ?>
		</h1>
		<?php 
    if (is_featured_item()) {
        $post_type = get_post_type();
        echo '<p>' . get_post_type_object($post_type)->description . '</p>';
    } else {
        echo category_description();
    }
    ?>
	</div>
<?php 
}
Example #14
0
/**
 * After content
 * @return void
 */
function basey_content_after_output()
{
    ?>

				</div>
				<?php 
    if (get_post_type(get_the_ID()) == 'post') {
        ?>
				<div class="uk-width-medium-3-10">
					<div class="uk-panel uk-panel-box">
						<?php 
        dynamic_sidebar('basey-sidebar');
        ?>
					</div>
				</div>
				<?php 
    }
    ?>
			</div>
		</div>
	</section>
	<div id="offcanvas-menu" class="uk-offcanvas">
		<div class="uk-offcanvas-bar uk-offcanvas-bar-flip">
			<?php 
    wp_nav_menu(array('menu' => 'primary', 'theme_location' => 'primary', 'depth' => 2, 'container' => '', 'menu_class' => 'uk-nav uk-nav-offcanvas uk-nav-parent-icon', 'items_wrap' => '<ul id="%1$s" class="%2$s" data-uk-nav>%3$s</ul>', 'fallback_cb' => 'basey_offcanvas_menu::fallback', 'walker' => new basey_offcanvas_menu()));
    ?>
		</div>
	</div>
	<?php 
}
Example #15
0
function nav_menu_add_classes2($items, $args)
{
    //print_r($items);
    global $post;
    $i = 0;
    $j = false;
    $a = false;
    foreach ($items as $item) {
        $i++;
        if (is_single() && get_post_type() == 'interesting-fact') {
            //get parent page ID by checking which page uses interesting fatcs page template
            $pages = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'page-templates/interesting_facts.php', 'lang' => pll_current_language('slug')));
            $parent_page_id = $pages[0]->ID;
            if ($item->object_id == $parent_page_id) {
                // $item->classes[] = 'current_page_parent';
                $item->classes[] = 'current_menu_item';
                $j = $i - 1;
                $a = $item->ID;
            }
        }
    }
    if ($j) {
        // $items[$j]->classes[] = 'current_page_parent';
        $items[1]->classes[] = 'current_page_ancestor';
    }
    if ($a) {
        echo $a;
    }
    return $items;
}
Example #16
0
/**
 * Get the active popup for a given post, if any
 *
 * @since 2.0
 *
 * @param int $post_id Post ID
 *
 * @return bool|int
 */
function wpbo_get_popup($post_id = 0)
{
    $post_id = wpbo_get_post_id($post_id);
    $popup_id = false;
    if (!$post_id) {
        return false;
    }
    // Get the global popups / posts relationships
    $relationships = get_option('wpbo_popup_relationships', array());
    // Get current post type
    $post_type = get_post_type($post_id);
    /**
     * If this post ID is found in the relationships then it means it has a popup attached.
     */
    if (is_array($relationships) && array_key_exists($post_id, $relationships) && 'publish' == get_post_status($relationships[$post_id])) {
        return (int) $relationships[$post_id];
    } else {
        // Check if there is a popup for the current post type first of all
        $popup_id = wpbo_get_post_type_popup($post_type);
        if (false === $popup_id) {
            $popup_id = wpbo_get_sitewide_popup();
        }
    }
    return $popup_id;
}
Example #17
0
 function remove_view_row_action($actions)
 {
     if (get_post_type() === 'bs_slide') {
         unset($actions['view']);
     }
     return $actions;
 }
Example #18
0
 function update_sale_price($post_id)
 {
     if (get_post_type($post_id) == $this->post_type) {
         $price = STRental::get_price($post_id);
         update_post_meta($post_id, 'sale_price', $price);
     }
 }
Example #19
0
 function the_content($content)
 {
     // Don't show on custom page templates
     if (is_page_template()) {
         return $content;
     }
     // Don't show on Stacked slides
     if (get_post_type() == 'slide') {
         return $content;
     }
     global $wp_current_filter;
     if (in_array('get_the_excerpt', (array) $wp_current_filter)) {
         return $content;
     }
     $cce_options = get_option('cce_options');
     $show_on_posts = isset($cce_options['show_loveit_button_on']['post']) ? $cce_options['show_loveit_button_on']['post'] : FALSE;
     $show_on_pages = isset($cce_options['show_loveit_button_on']['page']) ? $cce_options['show_loveit_button_on']['page'] : FALSE;
     if (is_singular('post') && $show_on_posts) {
         $content .= $this->do_likes('loveit-after-content');
     }
     if (is_page() && !is_front_page() && $show_on_pages) {
         $content .= $this->do_likes('loveit-after-content');
     }
     //Under consideration: if(( is_front_page() || is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other'] ) $content .= $this->do_likes();
     return $content;
 }
    function lp_preview_iframe()
    {
        $lp_variation = isset($_GET['lp-variation-id']) ? $_GET['lp-variation-id'] : '0';
        $postid = $_GET['post_id'];
        $variations = get_post_meta($postid, 'lp-ab-variations', true);
        $variations_array = explode(",", $variations);
        $post_type_is = get_post_type($postid);
        ?>
		<link rel="stylesheet" href="<?php 
        echo LANDINGPAGES_URLPATH . 'css/customizer-ab-testing.css';
        ?>
" />
		<style type="text/css">
		#variation-list {
			position: absolute;
			top: 0px;
			left:0px;
			padding-left: 5px;
		}
		#variation-list h3 {
			text-decoration: none;
			border-bottom: none;
		}
		#variation-list div {
			display: inline-block;
		}
		#current_variation_id, #current-post-id {
			display: none !important;
		}
		<?php 
        if ($post_type_is !== "landing-page") {
            echo "#variation-list {display:none !important;}";
        }
function ewic_popup_content()
{
    if (strstr($_SERVER['REQUEST_URI'], 'wp-admin/post-new.php') || strstr($_SERVER['REQUEST_URI'], 'wp-admin/post.php')) {
        if (get_post_type(get_the_ID()) != 'easyimageslider') {
            // START GENERATE POPUP CONTENT
            ?>
<div id="ewicmodal" style="display:none;">
<div id="tinyform" style="width: 550px;">
<form method="post">

<div class="ewic_input" id="ewictinymce_select_slider_div">
<label class="label_option" for="ewictinymce_select_slider">Slider</label>
	<select class="ewic_select" name="ewictinymce_select_slider" id="ewictinymce_select_slider">
    <option id="selectslider" type="text" value="select">- Select Slider -</option>
</select>
<div class="clearfix"></div>
</div>

<div class="ewic_button">
<input type="button" value="Insert Shortcode" name="ewic_insert_scrt" id="ewic_insert_scrt" class="button-secondary" />	
<div class="clearfix"></div>
</div>

</form>
</div>
</div>
<?php 
        }
    }
    //END
}
Example #22
0
 function md_thumbnail($size = 'md-half', $post_id, $fallback = true, $link = true, $return = false)
 {
     if (!has_post_thumbnail($post_id) && !$fallback) {
         return false;
     }
     $post_type = get_post_type($post_id) ? get_post_type($post_id) : 'post';
     $output = '<div class="featured-image">';
     if ($link) {
         $output .= '<a href="' . get_the_permalink($post_id) . '" title="' . esc_attr(get_the_title($post_id)) . '">';
     }
     if (has_post_thumbnail($post_id)) {
         $output .= get_the_post_thumbnail($post_id, $size);
     } elseif ($fallback) {
         $output .= '<img src="' . MD_THEME_URI . '/assets/img/placeholder/image-' . $size . '.png" alt="" />';
     } else {
         return false;
     }
     $output .= '<div class="featured-image-overlay"><span></span></div>';
     if ($link) {
         $output .= '</a>';
     }
     $output .= '</div>';
     if (!$return) {
         echo $output;
     } else {
         return $output;
     }
 }
 public function __construct($post = null)
 {
     $this->initial = true;
     $this->form = '';
     $this->mail = array();
     $this->mail_2 = array();
     $this->messages = array();
     $this->additional_settings = '';
     $post = get_post($post);
     if ($post && self::post_type == get_post_type($post)) {
         $this->initial = false;
         $this->id = $post->ID;
         $this->title = $post->post_title;
         $props = $this->get_properties();
         foreach ($props as $prop => $value) {
             if (metadata_exists('post', $post->ID, '_' . $prop)) {
                 $this->{$prop} = get_post_meta($post->ID, '_' . $prop, true);
             } else {
                 $this->{$prop} = get_post_meta($post->ID, $prop, true);
             }
         }
         $this->upgrade();
     }
     do_action_ref_array('wpcf7_contact_form', array(&$this));
 }
 public function do_shortcode($args)
 {
     $content_type = get_post_type();
     $ct_settings = get_option(RAPHAEL_SETTINGS . '_' . $content_type);
     $settings = get_option(RAPHAEL_SETTINGS);
     $custom = get_post_custom();
     //dpr(get_defined_vars());
     $values = $colors = $labels = array();
     foreach ($ct_settings['active_custom_fields'] as $field) {
         $values[] = $custom[$field][0];
         $colors[] = $ct_settings['custom_field_colors'][$field];
         if ($ct_settings[$content_type . '_showlabels']) {
             $labels[] = str_replace("%v%", $custom[$field][0], $ct_settings['custom_field_label'][$field]);
         }
     }
     //dpr(get_defined_vars());dpr($ct_settings[$content_type.'_dohover']);
     $js = self::script_bar_chart($values, $colors, $labels, $ct_settings[$content_type . '_barendtype'], 'chart-wrapper', $ct_settings[$content_type . '_dohover']);
     //$func = function() use ($js) { print $js; };
     //$code = "print '$js';";
     //$func = create_function('', $code);
     //dpr(get_defined_vars());
     //add_action('wp_footer', $func );
     self::$footer_js .= $js;
     return '<div id="chart-wrapper" style="width:' . $ct_settings[$content_type . '_chartwidth'] . 'px; height:' . $ct_settings[$content_type . '_chartheight'] . 'px;"></div>';
 }
 /**
  * the_content filter that will add linked posts to the bottom of the main post content
  *
  * @param $content
  *
  * @return string
  */
 public function run($content)
 {
     /**
      * Wow, what's going on here?! Well, setup_postdata() sets a lot of variables but does not change the $post variable.
      * All checks return the main queried ID but we want to check if this specific filter call is the for the 'main' content.
      * The method setup_postdata() does global and set the $id variable, so we're checking that.
      */
     global $id;
     // Only run on single
     if (!is_singular() || !is_main_query() || $id != get_queried_object_id()) {
         return $content;
     }
     // Allow disabling content filter
     if (false === apply_filters('rp4wp_append_content', true)) {
         return $content;
     }
     // The Post Type
     $post_type = get_post_type($id);
     // The Post Type Manager
     $pt_manager = new RP4WP_Post_Type_Manager();
     // Check if this Post Type is installed
     if ($pt_manager->is_post_type_installed($post_type) && isset(RP4WP()->settings['general_' . $post_type])) {
         // Related Post Manager
         $related_post_manager = new RP4WP_Related_Post_Manager();
         // The Output
         $output = $related_post_manager->generate_related_posts_list($id);
         // Add output if there is any
         if ('' != $output) {
             $content .= $output;
         }
     }
     // Return the content
     return $content;
 }
Example #26
0
 /**
  * Save the custom Status, used when posting to an Fan Page's Timeline
  *
  * @since 1.0
  * @param int $post_id post identifier
  */
 public static function save($post_id)
 {
     // verify if this is an auto save routine.
     // If it is our form has not been submitted, so we dont want to do anything
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
         return;
     }
     // verify this came from the our screen and with proper authorization,
     // because save_post can be triggered at other times
     if (!isset($_POST[self::FIELD_MESSAGE]) || empty($_POST[self::NONCE_NAME]) || !wp_verify_nonce($_POST[self::NONCE_NAME], plugin_basename(__FILE__))) {
         return;
     }
     // Check permissions
     $post_type = get_post_type($post_id);
     if (!($post_type && post_type_supports($post_type, 'author'))) {
         return;
     }
     if (!class_exists('Facebook_Social_Publisher')) {
         require_once dirname(__FILE__) . '/social_publisher.php';
     }
     $capability_singular_base = Facebook_Social_Publisher::post_type_capability_base($post_type);
     if (!current_user_can('edit_' . $capability_singular_base, $post_id)) {
         return;
     }
     $message = trim(sanitize_text_field($_POST[self::FIELD_MESSAGE]));
     if ($message) {
         update_post_meta($post_id, self::POST_META_KEY, $message);
     }
 }
function al_portfolio_meta_tags()
{
    $post_type = get_post_type();
    if ('portfolio' == $post_type) {
        $title = get_post_meta(get_the_ID(), "al_pf_og_title", TRUE);
        $title = !empty($title) ? $title : get_the_title();
        $meta = array('og:title' => $title, 'og:url' => get_permalink());
        $desc = get_post_meta(get_the_ID(), "al_pf_og_description", TRUE);
        $desc = !empty($desc) ? $desc : false;
        if ($desc) {
            $meta['og:description'] = $desc;
        }
        if (has_post_thumbnail()) {
            $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $meta['og:image'] = $thumbnail[0];
        }
        if (get_post_format() == 'gallery') {
            $images = rwmb_meta('al_pf_gallery_images', 'type=image&size=full');
            if (is_array($images)) {
                foreach ($images as $image) {
                    $meta['images'][] = $image['url'];
                }
            }
        }
        foreach ($meta as $key => $value) {
            if ($key == 'images') {
                foreach ($value as $image) {
                    echo '<meta property="og:image" content="' . $image . '" />';
                }
            } else {
                echo '<meta property="' . $key . '" content="' . $value . '" />';
            }
        }
    }
}
Example #28
0
/**
 * Render Wish List Columns
 *
 * @since 1.0
 * @param string $column_name Column name
 * @param int $post_id Download (Post) ID
 * @return void
 */
function edd_wl_render_admin_columns($column_name, $post_id)
{
    if (get_post_type($post_id) == 'edd_wish_list') {
        $items = get_post_meta(get_the_ID(), 'edd_wish_list', true);
        switch ($column_name) {
            case 'downloads':
                if ($items) {
                    echo count($items);
                } else {
                    echo 0;
                }
                break;
            case 'total':
                echo edd_wl_get_list_total(get_the_ID());
                break;
            case 'list_author':
                $post = get_post();
                if (0 == $post->post_author) {
                    echo __('Guest', 'edd-wish-lists');
                } else {
                    printf('<a href="%s">%s</a>', esc_url(add_query_arg(array('post_type' => $post->post_type, 'author' => get_the_author_meta('ID')), 'edit.php')), get_the_author());
                }
                break;
        }
    }
}
 public function check_img_size($file)
 {
     $mis_params = get_option('mis_img_params');
     // Check to see what kind of input the user is editing
     $meta_key = get_user_meta(get_current_user_id(), 'last_user_field_mod', true);
     // check if there is a custom field image restriction
     if (is_array($mis_params['custom_field']) && array_key_exists($meta_key['field_key'], $mis_params['custom_field'])) {
         $min_width = $mis_params['custom_field'][$meta_key['field_key']][0];
         $min_height = $mis_params['custom_field'][$meta_key['field_key']][1];
     } elseif ($meta_key['field_key'] === false) {
         $post_type = get_post_type($_REQUEST['post_id']);
         if (is_array($mis_params['post_type']) && array_key_exists($post_type, $mis_params['post_type'])) {
             $min_width = $mis_params['post_type'][$post_type][0];
             $min_height = $mis_params['post_type'][$post_type][1];
         }
     }
     if (isset($min_width) && isset($min_height)) {
         $img = getimagesize($file['tmp_name']);
         $minimum = array('width' => $min_width, 'height' => $min_height);
         $width = $img[0];
         $height = $img[1];
         if ($width < $minimum['width']) {
             return array("error" => "Image dimensions are too small. Minimum width is {$minimum['width']}px. Uploaded image width is {$width} px");
         } elseif ($height < $minimum['height']) {
             return array("error" => "Image dimensions are too small. Minimum height is {$minimum['height']}px. Uploaded image height is {$height} px");
         } else {
             return $file;
         }
     } else {
         return $file;
     }
 }
Example #30
-1
 /**
  * Prints HTML with meta information for the categories, tags and comments.
  */
 function xmaps_entry_footer()
 {
     // Hide category and tag text for pages.
     if ('post' === get_post_type()) {
         /* translators: used between list items, there is a space after the comma */
         $categories_list = get_the_category_list(esc_html__(', ', 'xmaps'));
         if ($categories_list && xmaps_categorized_blog()) {
             printf('<span class="cat-links">' . esc_html__('Posted in %1$s', 'xmaps') . '</span>', $categories_list);
             // WPCS: XSS OK.
         }
         /* translators: used between list items, there is a space after the comma */
         $tags_list = get_the_tag_list('', esc_html__(', ', 'xmaps'));
         if ($tags_list) {
             printf('<span class="tags-links">' . esc_html__('Tagged %1$s', 'xmaps') . '</span>', $tags_list);
             // WPCS: XSS OK.
         }
     }
     if (!is_single() && !post_password_required() && (comments_open() || get_comments_number())) {
         echo '<span class="comments-link">';
         /* translators: %s: post title */
         comments_popup_link(sprintf(wp_kses(__('Leave a Comment<span class="screen-reader-text"> on %s</span>', 'xmaps'), array('span' => array('class' => array()))), get_the_title()));
         echo '</span>';
     }
     edit_post_link(sprintf(esc_html__('Edit %s', 'xmaps'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
 }