/** * WP_Footer hook * * @since Custom 1.0 * @return void */ function cookies_wp_footer() { $cookies_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . COOKIES_TOOL_NAME . '/templates/tool-cookies-template-legislation.php'); if (!empty($cookies_template)) { include $cookies_template; } }
/** * This action is called by Custom when metabox is displayed on post-type * @param unknown $post */ function event_add_inner_meta_boxes($post) { $id_blog_page = get_option('page_for_posts'); if ($id_blog_page != get_the_ID()) { if (get_post_type($post) == 'event') { include locate_ressource('/' . CUSTOM_PLUGIN_TOOLS_FOLDER . EVENT_TOOL_NAME . '/templates/template-event-fields.php'); } } }
/** * template_include filter (allow to override template hierarchy) * @since WIP 1.0 * @return template path */ function wip_template_include($template) { $wip_template = ''; if (tool_wip_is_wip()) { $wip_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . WIP_TOOL_NAME . '/templates/tool-wip-page.php'); } if (!empty($wip_template)) { return $wip_template; } else { return $template; } }
/** * template_include filter (allow to override template hierarchy) * @return template path */ function private_template_include($template) { $post_id = get_the_id(); if (is_home()) { $post_id = get_option('page_for_posts'); } if (tool_private_is_private_post($post_id) && !is_user_logged_in()) { $private_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . PRIVATE_TOOL_NAME . '/templates/tool-private-template.php'); if (!empty($private_template)) { $template = $private_template; } else { wp_redirect(wp_login_url(get_current_url(true))); } } return $template; }
public function form($instance) { if (isset($instance['title'])) { $title = $instance['title']; } else { $title = __("Events", CUSTOM_PLUGIN_TEXT_DOMAIN); } if (isset($instance['nb'])) { $nb = $instance['nb']; } else { $nb = 5; } // Widget admin form $template = locate_ressource('/' . CUSTOM_PLUGIN_TOOLS_FOLDER . EVENT_TOOL_NAME . '/widgets/templates/tool-event-widget-form.php'); if (!empty($template)) { include $template; } }
/** * retrieve configuration's form for wall présentation */ function wall_ajax_get_wall_presentation_results() { if (!check_ajax_referer('wall-ajax-nonce', 'ajaxNonce', false)) { die('Busted!'); } $response = array('what' => 'wall_ajax_get_wall_presentation_results', 'action' => 'wall_ajax_get_wall_presentation_results', 'id' => '1'); $wall_args = array(); foreach ($_POST as $k => $v) { if (startsWith($k, "meta_wall_")) { $wall_args[$k] = $v; } } ob_start(); $wall_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . WALL_TOOL_NAME . '/templates/tool-wall-display.php'); if (!empty($wall_template)) { include $wall_template; } $results = ob_get_contents(); ob_end_clean(); $response['data'] = $results; $xmlResponse = new WP_Ajax_Response($response); $xmlResponse->send(); exit; }
/** * load settings template */ function tool_private_settings_template() { tool_private_settings_save(); ?> <form method="post" action="<?php echo get_current_url(true); ?> "> <input type="hidden" name="<?php echo TOOL_PRIVATE_OPTIONS_NONCE_ACTION; ?> " value="<?php echo wp_create_nonce(TOOL_PRIVATE_OPTIONS_NONCE_ACTION); ?> " /> <?php require_once locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . PRIVATE_TOOL_NAME . '/inc/options-fields.php'); submit_button(); ?> </form> <?php }
/** * retrieve post */ function postpicker_ajax_postpicker_get_post() { if (!check_ajax_referer('postpicker-ajax-nonce', 'ajaxNonce', false)) { die('Busted!'); } $response = array('what' => 'postpicker_ajax_postpicker_get_post', 'action' => 'postpicker_ajax_postpicker_get_post', 'id' => '1'); $results = ""; $post_id = null; if (isset($_POST['post_id']) && !empty($_POST['post_id'])) { $post_id = $_POST['post_id']; } $asked_post = get_post($post_id); if ($asked_post) { global $post; $post = $asked_post; setup_postdata($post); ob_start(); $postpick_item_template = locate_ressource(CUSTOM_PLUGIN_COMMONS_FOLDER . '/postpicker/templates/postpicker-item.php'); if (!empty($postpick_item_template)) { include $postpick_item_template; } $results = ob_get_contents(); ob_end_clean(); wp_reset_postdata(); } $response['data'] = $results; $xmlResponse = new WP_Ajax_Response($response); $xmlResponse->send(); exit; }
><?php echo $available_template; ?> </option> <?php } ?> </select> </td> </tr> </table> <?php $wall_args["meta_wall_admin_item_code"] = ob_get_contents(); ob_end_clean(); } $template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . WALL_TOOL_NAME . '/templates/tool-wall-template-isotope-' . $template_selected . '.php'); include $template; wp_reset_postdata(); } ?> </ul> </div> <?php if (!is_admin()) { ?> <script type="text/javascript"> jQuery(document).ready(function($) { // isotope apply after trigger by custom-gallery.js var $isotope = $('#isotope-wall-<?php echo get_the_ID();
?> </h2> <?php } else { ?> <ul> <?php foreach ($posts as $post) { setup_postdata($post); ?> <li class="post-item" data-id="<?php echo get_the_ID(); ?> "> <?php $postpick_item_template = locate_ressource(CUSTOM_PLUGIN_COMMONS_FOLDER . '/postpicker/templates/postpicker-item.php'); if (!empty($postpick_item_template)) { include $postpick_item_template; } ?> <div class="selected-box"> <i class="fa fa-check added"></i> <i class="fa fa-minus remove"></i> </div> <div class="selectable-area"></div> </li> <?php wp_reset_postdata(); } ?> </ul>
function wall_filter_the_content($content) { if (in_array(get_post_type(get_the_ID()), get_displayed_post_types()) && (is_single(get_the_ID()) || is_page(get_the_ID()))) { // never for search, listing, ... $meta_wall_display_post_type = get_post_meta(get_the_ID(), META_WALL_DISPLAY_POST_TYPE, true); $meta_wall_display_position = get_post_meta(get_the_ID(), META_WALL_DISPLAY_POSITION, true); if (!empty($meta_wall_display_post_type) && $meta_wall_display_post_type != '0') { $content = '<div class="content-with-wall-wrapper"><div class="content-with-wall">' . $content . '</div></div>'; ob_start(); $wall_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . WALL_TOOL_NAME . '/templates/tool-wall-display.php'); if (!empty($wall_template)) { include $wall_template; } if (empty($meta_wall_display_position) || $meta_wall_display_position == 'before-content') { $content = ob_get_contents() . $content; } else { if ($meta_wall_display_position == 'after-content') { $content = $content . ob_get_contents(); } } ob_end_clean(); } } return $content; }
/** * include video template * @param unknown $post */ function video_add_inner_meta_boxes($post) { include locate_ressource('/' . CUSTOM_PLUGIN_TOOLS_FOLDER . VIDEO_TOOL_NAME . '/custom-fields/templates/featured-video.php'); }
<?php $today_timestamp = time(); $today_timestamp_more_two_years = time() + 365 * 2 * 60 * 60 * 24; $events = get_event_post_types(array(), array('orderby' => 'meta_value_num', 'meta_key' => 'meta_event_date_begin', 'posts_per_page' => $nb, 'order' => 'ASC', 'meta_query' => array(array('key' => 'meta_event_date_begin', 'value' => array($today_timestamp, $today_timestamp_more_two_years), 'compare' => 'BETWEEN')))); if (!empty($events)) { ?> <ul class="list-events"> <?php global $post; foreach ($events as $post) { setup_postdata($post); ?> <li class="event"> <?php $template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . EVENT_TOOL_NAME . '/widgets/templates/tool-event-widget-output-event.php'); if (!empty($template)) { include $template; } ?> </li> <?php wp_reset_postdata(); } ?> </ul> <div style="clear: both;"></div> <?php } else { ?> <div class="no-content"><?php
/** * This action is called by Custom when metabox is displayed on post-type * @param unknown $post */ function pagination_add_inner_meta_boxes($post) { if (in_array(get_post_type($post), get_displayed_post_types())) { include locate_ressource('/' . CUSTOM_PLUGIN_TOOLS_FOLDER . PAGINATION_TOOL_NAME . '/custom-fields/templates/display-pagination.php'); } }
/** * Hooks the WP taxonomyname_edit_fields action to add metaboxe seo on term * * @return void */ function seo_add_taxonomy_fields($term) { include locate_ressource('/' . CUSTOM_PLUGIN_TOOLS_FOLDER . SEO_TOOL_NAME . '/custom-fields/templates/seo-term.php'); }
/** * override wp gallery * @param string $output * @param array $attr * @return string */ function gallery_post_gallery($output, $attr) { $res = ''; if (in_array(get_post_type(get_the_ID()), get_displayed_post_types())) { $meta_gallery_presentation = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION, true); $meta_gallery_presentation_height = get_post_meta(get_the_ID(), META_GALLERY_HEIGHT, true); $meta_gallery_presentation_format = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_FORMAT, true); $meta_gallery_disable_fancybox = get_post_meta(get_the_ID(), META_GALLERY_DISABLE_FANCYBOX, true); $meta_gallery_presentation_slider_autoplay = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_AUTOPLAY, true); $meta_gallery_presentation_slider_thumb_nav = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_THUMB_NAV, true); $meta_gallery_presentation_slider_carousel = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_CAROUSEL, true); $meta_gallery_presentation_slider_carousel_item_width = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_CAROUSEL_ITEM_WIDTH, true); $meta_gallery_presentation_slider_carousel_item_margin = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_SLIDER_CAROUSEL_ITEM_MARGIN, true); $meta_gallery_presentation_masonry_width = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_MASONRY_WIDTH, true); $meta_gallery_presentation_masonry_width_customized = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_MASONRY_WIDTH_CUSTOMIZED, true); $meta_gallery_presentation_masonry_height = get_post_meta(get_the_ID(), META_GALLERY_PRESENTATION_MASONRY_HEIGHT, true); $output = ""; global $gallery_post_count; global $post; if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => ''), $attr)); $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } if (!empty($attachments)) { $gallery_post_count++; ob_start(); $gallery_template = locate_ressource(CUSTOM_PLUGIN_TOOLS_FOLDER . GALLERY_TOOL_NAME . '/templates/tool-gallery-display.php'); if (!empty($gallery_template)) { include $gallery_template; } $output = ob_get_contents(); ob_end_clean(); } } return $output; }
public function form($instance) { if (isset($instance['social-title'])) { $title = $instance['social-title']; } else { $title = ""; } if (isset($instance['social-facebook-url'])) { $facebook_url = $instance['social-facebook-url']; } else { $facebook_url = ""; } if (isset($instance['social-twitter-url'])) { $twitter_url = $instance['social-twitter-url']; } else { $twitter_url = ""; } if (isset($instance['social-mail-url'])) { $mail_url = $instance['social-mail-url']; } else { $mail_url = ""; } if (isset($instance['social-download-url'])) { $download_url = $instance['social-download-url']; } else { $download_url = ""; } if (isset($instance['social-instagram-url'])) { $instagram_url = $instance['social-instagram-url']; } else { $instagram_url = ""; } if (isset($instance['social-pinterest-url'])) { $pinterest_url = $instance['social-pinterest-url']; } else { $pinterest_url = ""; } if (isset($instance['social-vimeo-url'])) { $vimeo_url = $instance['social-vimeo-url']; } else { $vimeo_url = ""; } if (isset($instance['social-youtube-url'])) { $youtube_url = $instance['social-youtube-url']; } else { $youtube_url = ""; } if (isset($instance['social-dribbble-url'])) { $dribbble_url = $instance['social-dribbble-url']; } else { $dribbble_url = ""; } if (isset($instance['social-googleplus-url'])) { $googleplus_url = $instance['social-googleplus-url']; } else { $googleplus_url = ""; } if (isset($instance['social-linkedin-url'])) { $linkedin_url = $instance['social-linkedin-url']; } else { $linkedin_url = ""; } if (isset($instance['social-behance-url'])) { $behance_url = $instance['social-behance-url']; } else { $behance_url = ""; } if (isset($instance['social-tumblr-url'])) { $tumblr_url = $instance['social-tumblr-url']; } else { $tumblr_url = ""; } if (isset($instance['social-flickr-url'])) { $flickr_url = $instance['social-flickr-url']; } else { $flickr_url = ""; } if (isset($instance['social-soundcloud-url'])) { $soundcloud_url = $instance['social-soundcloud-url']; } else { $soundcloud_url = ""; } if (isset($instance['social-backgrounded']) && $instance['social-backgrounded'] == 'on') { $backgrounded = "on"; } else { $backgrounded = ""; } // Widget admin form $template = locate_ressource('/' . CUSTOM_PLUGIN_TOOLS_FOLDER . SOCIAL_TOOL_NAME . '/widgets/templates/tool-social-widget-form.php'); if (!empty($template)) { include $template; } }