- <?php
- /**
- * Twenty Thirteen functions and definitions
- *
- * Sets up the theme and provides some helper functions, which are used in the
- * theme as custom template tags. Others are attached to action and filter
- * hooks in WordPress to change core functionality.
- *
- * When using a child theme (see https://codex.wordpress.org/Theme_Development
- * and https://codex.wordpress.org/Child_Themes), you can override certain
- * functions (those wrapped in a function_exists() call) by defining them first
- * in your child theme's functions.php file. The child theme's functions.php
- * file is included before the parent theme's file, so the child theme
- * functions would be used.
- *
- * Functions that are not pluggable (not wrapped in function_exists()) are
- * instead attached to a filter or action hook.
- *
- * For more information on hooks, actions, and filters, @link https://codex.wordpress.org/Plugin_API
- *
- * @package WordPress
- * @subpackage Twenty_Thirteen
- * @since Twenty Thirteen 1.0
- */
- /*
- * Set up the content width value based on the theme's design.
- *
- * @see twentythirteen_content_width() for template-specific adjustments.
- */
- if ( ! isset( $content_width ) )
- $content_width = 604;
- /**
- * Add support for a custom header image.
- */
- require get_template_directory() . '/inc/custom-header.php';
- /**
- * Twenty Thirteen only works in WordPress 3.6 or later.
- */
- if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) )
- require get_template_directory() . '/inc/back-compat.php';
- /**
- * Twenty Thirteen setup.
- *
- * Sets up theme defaults and registers the various WordPress features that
- * Twenty Thirteen supports.
- *
- * @uses load_theme_textdomain() For translation/localization support.
- * @uses add_editor_style() To add Visual Editor stylesheets.
- * @uses add_theme_support() To add support for automatic feed links, post
- * formats, and post thumbnails.
- * @uses register_nav_menu() To add support for a navigation menu.
- * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_setup() {
- /*
- * Makes Twenty Thirteen available for translation.
- *
- * Translations can be added to the /languages/ directory.
- * If you're building a theme based on Twenty Thirteen, use a find and
- * replace to change 'twentythirteen' to the name of your theme in all
- * template files.
- */
- load_theme_textdomain( 'twentythirteen', get_template_directory() . '/languages' );
- /*
- * This theme styles the visual editor to resemble the theme style,
- * specifically font, colors, icons, and column width.
- */
- add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentythirteen_fonts_url() ) );
- // Adds RSS feed links to <head> for posts and comments.
- add_theme_support( 'automatic-feed-links' );
- /*
- * Switches default core markup for search form, comment form,
- * and comments to output valid HTML5.
- */
- add_theme_support( 'html5', array(
- 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
- ) );
- /*
- * This theme supports all available post formats by default.
- * See https://codex.wordpress.org/Post_Formats
- */
- add_theme_support( 'post-formats', array(
- 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video'
- ) );
- // This theme uses wp_nav_menu() in one location.
- register_nav_menu( 'primary', __( 'Navigation Menu', 'twentythirteen' ) );
- /*
- * This theme uses a custom image size for featured images, displayed on
- * "standard" posts and pages.
- */
- add_theme_support( 'post-thumbnails' );
- set_post_thumbnail_size( 604, 270, true );
- // This theme uses its own gallery styles.
- add_filter( 'use_default_gallery_style', '__return_false' );
- }
- add_action( 'after_setup_theme', 'twentythirteen_setup' );
- /**
- * Return the Google font stylesheet URL, if available.
- *
- * The use of Source Sans Pro and Bitter by default is localized. For languages
- * that use characters not supported by the font, the font can be disabled.
- *
- * @since Twenty Thirteen 1.0
- *
- * @return string Font stylesheet or empty string if disabled.
- */
- function twentythirteen_fonts_url() {
- $fonts_url = '';
- /* Translators: If there are characters in your language that are not
- * supported by Source Sans Pro, translate this to 'off'. Do not translate
- * into your own language.
- */
- $source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'twentythirteen' );
- /* Translators: If there are characters in your language that are not
- * supported by Bitter, translate this to 'off'. Do not translate into your
- * own language.
- */
- $bitter = _x( 'on', 'Bitter font: on or off', 'twentythirteen' );
- if ( 'off' !== $source_sans_pro || 'off' !== $bitter ) {
- $font_families = array();
- if ( 'off' !== $source_sans_pro )
- $font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic';
- if ( 'off' !== $bitter )
- $font_families[] = 'Bitter:400,700';
- $query_args = array(
- 'family' => urlencode( implode( '|', $font_families ) ),
- 'subset' => urlencode( 'latin,latin-ext' ),
- );
- //$fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
- }
- return $fonts_url;
- }
- /**
- * Enqueue scripts and styles for the front end.
- *
- * @since Twenty Thirteen 1.0
- */
- add_image_size( 'medium-something', 480, 480 );
- add_image_size( 'my-thumbnail', 400, 1200, true);
- function twentythirteen_scripts_styles() {
- /*
- * Adds JavaScript to pages with the comment form to support
- * sites with threaded comments (when in use).
- */
- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
- wp_enqueue_script( 'comment-reply' );
- // Adds Masonry to handle vertical alignment of footer widgets.
- if ( is_active_sidebar( 'sidebar-1' ) )
- wp_enqueue_script( 'jquery-masonry' );
- // Loads JavaScript file with functionality specific to Twenty Thirteen.
- wp_enqueue_script( 'twentythirteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true );
- // Add Source Sans Pro and Bitter fonts, used in the main stylesheet.
- wp_enqueue_style( 'twentythirteen-fonts', twentythirteen_fonts_url(), array(), null );
- // Add Genericons font, used in the main stylesheet.
- wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.03' );
- // Loads our main stylesheet.
- wp_enqueue_style( 'twentythirteen-style', get_stylesheet_uri(), array(), '2013-07-18' );
- // Loads the Internet Explorer specific stylesheet.
- wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' );
- wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' );
- }
- add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );
- /**
- * Filter the page title.
- *
- * Creates a nicely formatted and more specific title element text for output
- * in head of document, based on current view.
- *
- * @since Twenty Thirteen 1.0
- *
- * @param string $title Default title text for current view.
- * @param string $sep Optional separator.
- * @return string The filtered title.
- */
- function twentythirteen_wp_title( $title, $sep ) {
- global $paged, $page;
- if ( is_feed() )
- return $title;
- // Add the site name.
- $title .= get_bloginfo( 'name', 'display' );
- // Add the site description for the home/front page.
- $site_description = get_bloginfo( 'description', 'display' );
- if ( $site_description && ( is_home() || is_front_page() ) )
- $title = "$title $sep $site_description";
- // Add a page number if necessary.
- if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() )
- $title = "$title $sep " . sprintf( __( 'Page %s', 'twentythirteen' ), max( $paged, $page ) );
- return $title;
- }
- add_filter( 'wp_title', 'twentythirteen_wp_title', 10, 2 );
- /**
- * Register two widget areas.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_widgets_init() {
- register_sidebar( array(
- 'name' => __( 'Main Widget Area', 'twentythirteen' ),
- 'id' => 'sidebar-1',
- 'description' => __( 'Appears in the footer section of the site.', 'twentythirteen' ),
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- register_sidebar( array(
- 'name' => __( 'Secondary Widget Area', 'twentythirteen' ),
- 'id' => 'sidebar-2',
- 'description' => __( 'Appears on posts and pages in the sidebar.', 'twentythirteen' ),
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- register_sidebar( array(
- 'name' => __( 'Mobile Menu', 'twentythirteen' ),
- 'id' => 'sidebar-3',
- 'description' => __( 'Appears on mobile.', 'twentythirteen' ),
- 'before_widget' => '<div class="mr-mobile-menu-out">',
- 'after_widget' => '</div>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- }
- add_action( 'widgets_init', 'twentythirteen_widgets_init' );
- if ( ! function_exists( 'twentythirteen_paging_nav' ) ) :
- /**
- * Display navigation to next/previous set of posts when applicable.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_paging_nav() {
- global $wp_query;
- // Don't print empty markup if there's only one page.
- if ( $wp_query->max_num_pages < 2 )
- return;
- ?>
- <nav class="navigation paging-navigation" role="navigation">
- <h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'twentythirteen' ); ?></h1>
- <div class="nav-links">
- <?php if ( get_next_posts_link() ) : ?>
- <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentythirteen' ) ); ?></div>
- <?php endif; ?>
- <?php if ( get_previous_posts_link() ) : ?>
- <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?></div>
- <?php endif; ?>
- </div><!-- .nav-links -->
- </nav><!-- .navigation -->
- <?php
- }
- endif;
- if ( ! function_exists( 'twentythirteen_post_nav' ) ) :
- /**
- * Display navigation to next/previous post when applicable.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_post_nav() {
- global $post;
- // Don't print empty markup if there's nowhere to navigate.
- $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true );
- $next = get_adjacent_post( false, '', false );
- if ( ! $next && ! $previous )
- return;
- ?>
- <nav class="navigation post-navigation" role="navigation">
- <h1 class="screen-reader-text"><?php _e( 'Post navigation', 'twentythirteen' ); ?></h1>
- <div class="nav-links">
- <?php previous_post_link( '%link', _x( '<span class="meta-nav">←</span> %title', 'Previous post link', 'twentythirteen' ) ); ?>
- <?php next_post_link( '%link', _x( '%title <span class="meta-nav">→</span>', 'Next post link', 'twentythirteen' ) ); ?>
- </div><!-- .nav-links -->
- </nav><!-- .navigation -->
- <?php
- }
- endif;
- if ( ! function_exists( 'twentythirteen_entry_meta' ) ) :
- /**
- * Print HTML with meta information for current post: categories, tags, permalink, author, and date.
- *
- * Create your own twentythirteen_entry_meta() to override in a child theme.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_entry_meta() {
- if ( is_sticky() && is_home() && ! is_paged() )
- echo '<span class="featured-post">' . esc_html__( 'Sticky', 'twentythirteen' ) . '</span>';
- if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
- twentythirteen_entry_date();
- // Translators: used between list items, there is a space after the comma.
- $categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );
- if ( $categories_list ) {
- echo '<span class="categories-links">' . $categories_list . '</span>';
- }
- // Translators: used between list items, there is a space after the comma.
- $tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );
- if ( $tag_list ) {
- echo '<span class="tags-links">' . $tag_list . '</span>';
- }
- // Post author
- if ( 'post' == get_post_type() ) {
- printf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
- esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
- esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),
- get_the_author()
- );
- }
- }
- endif;
- if ( ! function_exists( 'twentythirteen_entry_date' ) ) :
- /**
- * Print HTML with date information for current post.
- *
- * Create your own twentythirteen_entry_date() to override in a child theme.
- *
- * @since Twenty Thirteen 1.0
- *
- * @param boolean $echo (optional) Whether to echo the date. Default true.
- * @return string The HTML-formatted post date.
- */
- function twentythirteen_entry_date( $echo = true ) {
- if ( has_post_format( array( 'chat', 'status' ) ) )
- $format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' );
- else
- $format_prefix = '%2$s';
- $date = sprintf( '<span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a></span>',
- esc_url( get_permalink() ),
- esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),
- esc_attr( get_the_date( 'c' ) ),
- esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) )
- );
- if ( $echo )
- echo $date;
- return $date;
- }
- endif;
- if ( ! function_exists( 'twentythirteen_the_attached_image' ) ) :
- /**
- * Print the attached image with a link to the next attached image.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_the_attached_image() {
- /**
- * Filter the image attachment size to use.
- *
- * @since Twenty thirteen 1.0
- *
- * @param array $size {
- * @type int The attachment height in pixels.
- * @type int The attachment width in pixels.
- * }
- */
- $attachment_size = apply_filters( 'twentythirteen_attachment_size', array( 724, 724 ) );
- $next_attachment_url = wp_get_attachment_url();
- $post = get_post();
- /*
- * Grab the IDs of all the image attachments in a gallery so we can get the URL
- * of the next adjacent image in a gallery, or the first image (if we're
- * looking at the last image in a gallery), or, in a gallery of one, just the
- * link to that image file.
- */
- $attachment_ids = get_posts( array(
- 'post_parent' => $post->post_parent,
- 'fields' => 'ids',
- 'numberposts' => -1,
- 'post_status' => 'inherit',
- 'post_type' => 'attachment',
- 'post_mime_type' => 'image',
- 'order' => 'ASC',
- 'orderby' => 'menu_order ID',
- ) );
- // If there is more than 1 attachment in a gallery...
- if ( count( $attachment_ids ) > 1 ) {
- foreach ( $attachment_ids as $attachment_id ) {
- if ( $attachment_id == $post->ID ) {
- $next_id = current( $attachment_ids );
- break;
- }
- }
- // get the URL of the next image attachment...
- if ( $next_id )
- $next_attachment_url = get_attachment_link( $next_id );
- // or get the URL of the first image attachment.
- else
- $next_attachment_url = get_attachment_link( reset( $attachment_ids ) );
- }
- printf( '<a href="%1$s" title="%2$s" rel="attachment">%3$s</a>',
- esc_url( $next_attachment_url ),
- the_title_attribute( array( 'echo' => false ) ),
- wp_get_attachment_image( $post->ID, $attachment_size )
- );
- }
- endif;
- /**
- * Return the post URL.
- *
- * @uses get_url_in_content() to get the URL in the post meta (if it exists) or
- * the first link found in the post content.
- *
- * Falls back to the post permalink if no URL is found in the post.
- *
- * @since Twenty Thirteen 1.0
- *
- * @return string The Link format URL.
- */
- function twentythirteen_get_link_url() {
- $content = get_the_content();
- $has_url = get_url_in_content( $content );
- return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
- }
- if ( ! function_exists( 'twentythirteen_excerpt_more' ) && ! is_admin() ) :
- /**
- * Replaces "[...]" (appended to automatically generated excerpts) with ...
- * and a Continue reading link.
- *
- * @since Twenty Thirteen 1.4
- *
- * @param string $more Default Read More excerpt link.
- * @return string Filtered Read More excerpt link.
- */
- function twentythirteen_excerpt_more( $more ) {
- $link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
- esc_url( get_permalink( get_the_ID() ) ),
- /* translators: %s: Name of current post */
- sprintf( __( 'Continue reading %s <span class="meta-nav">→</span>', 'twentythirteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
- );
- return ' … ' . $link;
- }
- add_filter( 'excerpt_more', 'twentythirteen_excerpt_more' );
- endif;
- /**
- * Extend the default WordPress body classes.
- *
- * Adds body classes to denote:
- * 1. Single or multiple authors.
- * 2. Active widgets in the sidebar to change the layout and spacing.
- * 3. When avatars are disabled in discussion settings.
- *
- * @since Twenty Thirteen 1.0
- *
- * @param array $classes A list of existing body class values.
- * @return array The filtered body class list.
- */
- function twentythirteen_body_class( $classes ) {
- if ( ! is_multi_author() )
- $classes[] = 'single-author';
- if ( is_active_sidebar( 'sidebar-2' ) && ! is_attachment() && ! is_404() )
- $classes[] = 'sidebar';
- if ( ! get_option( 'show_avatars' ) )
- $classes[] = 'no-avatars';
- return $classes;
- }
- add_filter( 'body_class', 'twentythirteen_body_class' );
- /**
- * Adjust content_width value for video post formats and attachment templates.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_content_width() {
- global $content_width;
- if ( is_attachment() )
- $content_width = 724;
- elseif ( has_post_format( 'audio' ) )
- $content_width = 484;
- }
- add_action( 'template_redirect', 'twentythirteen_content_width' );
- /**
- * Add postMessage support for site title and description for the Customizer.
- *
- * @since Twenty Thirteen 1.0
- *
- * @param WP_Customize_Manager $wp_customize Customizer object.
- */
- function twentythirteen_customize_register( $wp_customize ) {
- $wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
- $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
- $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
- }
- add_action( 'customize_register', 'twentythirteen_customize_register' );
- /**
- * Enqueue Javascript postMessage handlers for the Customizer.
- *
- * Binds JavaScript handlers to make the Customizer preview
- * reload changes asynchronously.
- *
- * @since Twenty Thirteen 1.0
- */
- function twentythirteen_customize_preview_js() {
- wp_enqueue_script( 'twentythirteen-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20141120', true );
- }
- add_action( 'customize_preview_init', 'twentythirteen_customize_preview_js' );
- function themeslug_theme_customizer( $wp_customize ) {
- // Fun code will go here
- $wp_customize->add_section( 'themeslug_logo_section' , array(
- 'title' => __( 'Logo', 'themeslug' ),
- 'priority' => 30,
- 'description' => 'Upload a logo to replace the default site name and description in the header',
- ) );
- $wp_customize->add_setting( 'themeslug_logo' );
- $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'themeslug_logo', array(
- 'label' => __( 'Logo', 'themeslug' ),
- 'section' => 'themeslug_logo_section',
- 'settings' => 'themeslug_logo',
- ) ) );
- }
- add_action( 'customize_register', 'themeslug_theme_customizer' );
- //get number view
- /*function setPostViews($postID) {
- $count_key = 'post_views_count';
- $count = get_post_meta($postID, $count_key, true);
- if($count==''){
- $count = 0;
- delete_post_meta($postID, $count_key);
- add_post_meta($postID, $count_key, '0');
- }else{
- $count++;
- update_post_meta($postID, $count_key, $count);
- }
- }*/
- function getPostViews($postID){
- $count_key = 'post_views_count';
- $count = get_post_meta($postID, $count_key, true);
- if($count==''){
- delete_post_meta($postID, $count_key);
- add_post_meta($postID, $count_key, '0');
- return "0";
- }
- return $count.'';
- }
- // function to count views.
- function setPostViews($postID) {
- $count_key = 'post_views_count';
- $count = get_post_meta($postID, $count_key, true);
- if($count==''){
- $count = 0;
- delete_post_meta($postID, $count_key);
- add_post_meta($postID, $count_key, '0');
- }else{
- $count++;
- update_post_meta($postID, $count_key, $count);
- }
- }
- // Remove issues with prefetching adding extra views
- remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
- /* ################# Register Exclusive Galleries ############################ */
- function register_cutompost_model() {
- $labels = array(
- 'name' =>'Models',
- 'singular_name' =>'Model',
- 'menu_name' =>'Models',
- 'name_admin_bar' =>'Models',
- 'add_new' =>'Add New',
- 'add_new_item' =>'Add New Model',
- 'new_item' =>'New Model',
- 'edit_item' =>'Edit Model',
- 'view_item' =>'View Model',
- 'all_items' =>'All Model',
- 'search_items' =>'Search Model',
- 'parent_item_colon' =>'Parent Model',
- 'not_found' =>'No Models found.',
- 'not_found_in_trash' =>'No Models found in Trash.'
- );
- $args = array(
- 'labels' => $labels,
- 'description' =>'Description.',
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'bornstar', 'with_front' => FALSE ),
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => false,
- 'menu_position' =>8,
- 'supports' => array( 'title','thumbnail','editor','comments')
- );
- register_post_type( 'model', $args );
- }
- add_action( 'init', 'register_cutompost_model');
- function register_cutompost_freeGallery() {
- $labels = array(
- 'name' =>'Free Gallery',
- 'singular_name' =>'Free Gallery',
- 'menu_name' =>'Free Galleries',
- 'name_admin_bar' =>'Free Galleries',
- 'add_new' =>'Add New',
- 'add_new_item' =>'Add New Free gallery',
- 'new_item' =>'New Free gallery',
- 'edit_item' =>'Edit Free gallery',
- 'view_item' =>'View Free gallery',
- 'all_items' =>'All Free gallery',
- 'search_items' =>'Search Free gallery',
- 'parent_item_colon' =>'Parent Free gallery:',
- 'not_found' =>'No Free Galleries found.',
- 'not_found_in_trash' =>'No Free Galleries found in Trash.'
- );
- $args = array(
- 'labels' => $labels,
- 'description' =>'Description.',
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'gallery', 'with_front' => FALSE ),
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => false,
- 'menu_position' =>5,
- 'supports' => array( 'title','thumbnail','editor','comments')
- );
- register_post_type( 'freeGallery', $args );
- $labels1 = array(
- 'name' =>'Free Videos',
- 'singular_name' =>'Free Video',
- 'menu_name' =>'Free Videos',
- 'name_admin_bar' =>'Free Videos',
- 'add_new' =>'Add New',
- 'add_new_item' =>'Add New Free Video',
- 'new_item' =>'New Free Video',
- 'edit_item' =>'Edit Free Video',
- 'view_item' =>'View Free Video',
- 'all_items' =>'All Free Video',
- 'search_items' =>'Search Free Video',
- 'parent_item_colon' =>'Parent Free Video:',
- 'not_found' =>'No Free Videos found.',
- 'not_found_in_trash' =>'No Free Videos found in Trash.'
- );
- $args1 = array(
- 'labels' => $labels1,
- 'description' =>'Description.',
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'video','with_front' => FALSE ),
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => false,
- 'menu_position' =>6,
- 'supports' => array( 'title','thumbnail','editor','custom-fields','post-formats','comments' )
- );
- register_post_type( 'freeVideo', $args1 );
- /* #################### Register For Article ############### */
- $labels2 = array(
- 'name' =>'Blogs',
- 'singular_name' =>'Site',
- 'menu_name' =>'Blogs',
- 'name_admin_bar' =>'Blogs',
- 'add_new' =>'Add New',
- 'add_new_item' =>'Add New Blog',
- 'new_item' =>'New Blog',
- 'edit_item' =>'Edit Blog',
- 'view_item' =>'View Blog',
- 'all_items' =>'All Blog',
- 'search_items' =>'Search Site',
- 'parent_item_colon' =>'Parent Site:',
- 'not_found' =>'No Free Sites found.',
- 'not_found_in_trash' =>'No Free Sites found in Trash.'
- );
- $args2 = array(
- 'labels' => $labels2,
- 'description' =>'Description.',
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'article' ),
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => false,
- 'menu_position' =>7,
- 'supports' => array( 'title','thumbnail','editor','excerpt','comments')
- );
- register_post_type( 'blog',$args2);
- /* End code of Articles */
- /* #################### Register For Sites ############### */
- $labels3 = array(
- 'name' =>'Sites',
- 'singular_name' =>'Site',
- 'menu_name' =>'Sites',
- 'name_admin_bar' =>'Sites',
- 'add_new' =>'Add New',
- 'add_new_item' =>'Add New Site',
- 'new_item' =>'New Site',
- 'edit_item' =>'Edit Site',
- 'view_item' =>'View Site',
- 'all_items' =>'All Site',
- 'search_items' =>'Search Site',
- 'parent_item_colon' =>'Parent Site:',
- 'not_found' =>'No Free Sites found.',
- 'not_found_in_trash' =>'No Free Sites found in Trash.'
- );
- $args3 = array(
- 'labels' => $labels3,
- 'description' =>'Description.',
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'site' ),
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => false,
- 'menu_position' =>7,
- 'supports' => array( 'title','thumbnail','editor','comments')
- );
- register_post_type( 'mrsite',$args3);
- /* End code of Sites */
- }
- add_action( 'init', 'register_cutompost_freeGallery' );
- /* ################# Add Area for Free Gallery #######################*/
- add_action( 'add_meta_boxes', 'mr_free_galleries_area' );
- function mr_free_galleries_area()
- {
- /* add_meta_box('mr-free-gallery-section','Free Galleries Box','mr_free_galleryBox_callback','post'); */
- /* add_meta_box('mr-free-video-section','Free Videos Box','mr_free_videoBox_callback','post'); */
- add_meta_box('mr-discount-section','Discount Box','discount_price_fields','post');
- add_meta_box('mr-price-section','Price Box','price_table_fields','post');
- add_meta_box('mr-feature-section','Feature Box','feature_box_fields','post');
- add_meta_box('mr-random-post-section','Random Post And Feaure Video','randon_post','post');
- add_meta_box('mr-extra_tag-section','Custom Tag Fields','custom_tag_fields','post');
- add_meta_box('mr-magnifying_glass-section','Magnifying Glass','magnifying_glass','post');
- add_meta_box('mr-post-extra-section','Fields For Texr','post_extra_desc','post');
- add_meta_box('mr-dicounted-extra-section','Select Extra Discounted Sites Box','discount_extra_sites','post');
- /* Function that allow links to sites */
- add_meta_box('mr-model-siteopt','Model Appear in sites','mr_modelsites_sectionfun','model'); // For single model
- add_meta_box('mr-data-siteopt','Site Data Section','mr_sites_sectionfun','mrsite'); // For single model
- add_meta_box('mr-more-born-sites','Born Sites','more_born_sites','post', 'normal', 'high');
- add_meta_box('mr-FreeGallery-data','Gallery Data Section','mr_gallerydata_sectionfun','freegallery'); // For single gallery
- add_meta_box('mr-videosingle-data','Video Data Section','mr_video_data_sectionfun','freevideo'); // for single video
- add_meta_box('pr-detailss-section','Today offer','today_offer','post', 'normal', 'high');
- }
- /* Function For site data */
- function mr_sites_sectionfun($site_data)
- {
- ?>
- <table width="80%">
- <tr>
- <td width="110px">Enter Site Url</td>
- <td><input style="width:100%;" value="<?php echo get_post_meta($site_data->ID,"mr_siteCustomUrl",true); ?>" type="text" name="mr_siteCustomUrl" /></td>
- </tr>
- </table>
- <?php
- }
- /* //For model site opt */
- function mr_modelsites_sectionfun($model_data)
- {
- $model_id = $model_data->ID;
- $argsSites = array('post_type' =>'post','post_status'=>'publish','posts_per_page'=>-1);
- $my_sitequery = null;
- $my_sitequery = new WP_Query($argsSites);
- if($my_sitequery->have_posts())
- {
- ?>
- <style type="text/css">
- .listof-allsites-out li
- {
- background: #f5f5f5 none repeat scroll 0 0; border-radius:3px; float: left;
- margin-bottom: 10px;margin-left: 2px;margin-right: 2px; padding: 5px 8px;width: 22.5%;
- }
- .listof-allsites-out > ul {list-style: outside none none;margin:10px 0px;padding: 0;}
- .site-frm-submit-out { border-top: 2px solid #ddd; padding: 5px 2px; text-align: right;}
- .listof-allsites-out li:hover {background: #ddd none repeat scroll 0 0;}
- </style>
- <div class="listof-allsites-out">
- <?php
- $model_sitesId = get_post_meta($model_id,"mr_model_appear_sites",true);
- $model_sitesArr = explode(",",$model_sitesId) ;
- ?>
- <ul>
- <?php
- while($my_sitequery->have_posts()) : $my_sitequery->the_post();
- $site_id = get_the_ID();
- if(in_array($site_id,$model_sitesArr))
- {
- $mr_ckbstatus = 'checked="checked"';
- }
- else
- {
- $mr_ckbstatus='';
- }
- ?>
- <li>
- <input type="checkbox" name="mr_modelSite[]" <?php echo $mr_ckbstatus; ?> value="<?php echo $site_id; ?>" />
- <p style="display:inline;"> <?php echo get_the_title(); ?></p>
- </li>
- <?php
- endwhile;
- ?>
- <div style="clear:both;"></div>
- </ul>
- <div style="clear:both;"></div>
- </div>
- <?php
- wp_reset_query();
- }
- else
- {
- ?>
- <div class="error-mess"><h2 style="text-align:center; color:red;">No Sites</h2></div>
- <?php
- }
- }
- add_action('save_post', 'save_gallery_data');
- function save_gallery_data(){
- global $post;
- /* ########################################## Save Post model & site Data ################### */
- if($post->post_type == 'post'){
- update_post_meta($post->ID, 'mr_active_discount', $_POST['mr_active_discount']);
- $random_v =$_POST['mr_random_post'];
- if($random_v==''){
- update_post_meta($post->ID, 'mr_random_post', 'empty');
- }
- else{
- update_post_meta($post->ID, 'mr_random_post', $_POST['mr_random_post']);
- }
- update_post_meta($post->ID, 'mr_feature_video', $_POST['mr_feature_video']);
- update_post_meta($post->ID, 'catag', $_POST['catag']);
- update_post_meta($post->ID, 'domaintag', $_POST['domaintag']);
- update_post_meta($post->ID, 'post_external_link', $_POST['post_external_link']);
- update_post_meta($post->ID, 'joink_external_link', $_POST['joink_external_link']);
- update_post_meta($post->ID, 'titletag', $_POST['titletag']);
- update_post_meta($post->ID, 'mr_magnifying_glass', $_POST['mr_magnifying_glass']);
- update_post_meta($post->ID, 'mr_topdeal_discount', $_POST['mr_topdeal_discount']);
- update_post_meta($post->ID, 'mr_new_discount', $_POST['mr_new_discount']);
- update_post_meta($post->ID, 'mr_lifetime_discount', $_POST['mr_lifetime_discount']);
- update_post_meta($post->ID, 'mr_regularprice', $_POST['mr_regularprice']);
- update_post_meta($post->ID, 'mr_saleprice', $_POST['mr_saleprice']);
- update_post_meta($post->ID, 'mr_discountprice', $_POST['mr_discountprice']);
- update_post_meta($post->ID, 'mr_discount_des', $_POST['mr_discount_des']);
- update_post_meta($post->ID, 'mr_discount_Image', $_POST['mr_discount_Image']);
- update_post_meta($post->ID, 'mr_month_price', $_POST['mr_month_price']);
- @update_post_meta($post->ID, 'discount-extra-site', array_map( 'strip_tags', $_POST['discount-extra-site'] ) );
- update_post_meta($post->ID, 'mr_month_off', $_POST['mr_month_off']);
- update_post_meta($post->ID, 'mr_month_lastrice', $_POST['mr_month_lastrice']);
- update_post_meta($post->ID, 'mr_sixmonth_price', $_POST['mr_sixmonth_price']);
- update_post_meta($post->ID, 'mr_sixmonth_off', $_POST['mr_sixmonth_off']);
- update_post_meta($post->ID, 'mr_sixmonth_lastrice', $_POST['mr_sixmonth_lastrice']);
- update_post_meta($post->ID, 'mr_per_month3', $_POST['mr_per_month3']);
- update_post_meta($post->ID, 'mr_threeyear_price', $_POST['mr_threeyear_price']);
- update_post_meta($post->ID, 'mr_threeyear_off', $_POST['mr_threeyear_off']);
- update_post_meta($post->ID, 'mr_threeyear_lastrice', $_POST['mr_threeyear_lastrice']);
- update_post_meta($post->ID, 'mr_per_month6', $_POST['mr_per_month6']);
- update_post_meta($post->ID, 'mr_fiveyear_price', $_POST['mr_fiveyear_price']);
- update_post_meta($post->ID, 'mr_fiveyear_off', $_POST['mr_fiveyear_off']);
- update_post_meta($post->ID, 'mr_fiveyear_lastrice', $_POST['mr_fiveyear_lastrice']);
- update_post_meta($post->ID, 'mr_per_month12', $_POST['mr_per_month12']);
- update_post_meta($post->ID, 'mr_feature1', $_POST['mr_feature1']);
- update_post_meta($post->ID, 'mr_feature2', $_POST['mr_feature2']);
- update_post_meta($post->ID, 'mr_feature3', $_POST['mr_feature3']);
- update_post_meta($post->ID, 'mr_feature4', $_POST['mr_feature4']);
- update_post_meta($post->ID, 'mr_feature5', $_POST['mr_feature5']);
- update_post_meta($post->ID, 'mr_feature6', $_POST['mr_feature6']);
- update_post_meta($post->ID, 'mr_feature1_Image', $_POST['mr_feature1_Image']);
- update_post_meta($post->ID, 'mr_feature2_Image', $_POST['mr_feature2_Image']);
- update_post_meta($post->ID, 'mr_feature3_Image', $_POST['mr_feature3_Image']);
- update_post_meta($post->ID, 'mr_feature4_Image', $_POST['mr_feature4_Image']);
- update_post_meta($post->ID, 'mr_feature5_Image', $_POST['mr_feature5_Image']);
- update_post_meta($post->ID, 'mr_discount_des', $_POST['mr_discount_des']);
- update_post_meta($post->ID, 'mr_discount_Image', $_POST['mr_discount_Image']);
- update_post_meta($post->ID, 'mr_discountbutton_url', $_POST['mr_discountbutton_url']);
- update_post_meta($post->ID, 'mr_quility_des', $_POST['mr_quility_des']);
- update_post_meta($post->ID, 'mr_content_des', $_POST['mr_content_des']);
- /* update_post_meta($post->ID, 'mr_pros_des', $_POST['mr_pros_des']); */
- /* update_post_meta($post->ID, 'mr_cons_des', $_POST['mr_cons_des']); */
- /* update_post_meta($post->ID, 'mr_pb_des', $_POST['mr_pb_des']); */
- /* update_post_meta($post->ID, 'mr_conclusion_des', $_POST['mr_conclusion_des']); */
- update_post_meta($post->ID, 'site_id1', $_POST['site_id1']);
- update_post_meta($post->ID, 'site_id2', $_POST['site_id2']);
- update_post_meta($post->ID, 'site_id3', $_POST['site_id3']);
- update_post_meta($post->ID, 'site_id4', $_POST['site_id4']);
- update_post_meta($post->ID, 'site_id5', $_POST['site_id5']);
- update_post_meta($post->ID, 'site_id6', $_POST['site_id6']);
- update_post_meta($post->ID, 'site_id7', $_POST['site_id7']);
- update_post_meta($post->ID, 'site_id8', $_POST['site_id8']);
- update_post_meta($post->ID, 'mr_discountbutton_url', $_POST['mr_discountbutton_url']);
- update_post_meta($post->ID, 'today_offer', $_POST['today_offer']);
- }
- if($post->post_type == 'model')
- {
- $mr_modelSite=implode(",",$_POST['mr_modelSite']);
- update_post_meta($post->ID,"mr_model_appear_sites",$mr_modelSite);
- }
- if($post->post_type == 'mrsite')
- {
- $mr_siteCustomUrl=$_POST['mr_siteCustomUrl'];
- update_post_meta($post->ID,"mr_siteCustomUrl",$mr_siteCustomUrl);
- }
- if($post->post_type == 'freegallery')
- {
- /* update_post_meta($post->ID, 'mr_freeGallery_type', $_POST['mr_freeGallery_type']); */
- update_post_meta($post->ID, 'gallery_bannercode', $_POST['gallery_bannercode']);
- update_post_meta($post->ID, 'gallery_bottomtext', $_POST['gallery_bottomtext']);
- update_post_meta($post->ID, 'mr_freeGalleryModel', $_POST['mr_freeGalleryModel']);
- update_post_meta($post->ID, 'mr_freeGalleryModel_2', $_POST['mr_freeGalleryModel_2']);
- update_post_meta($post->ID, 'mr_freeGalleryDate', $_POST['mr_freeGalleryDate']);
- update_post_meta($post->ID, 'mr_freeGallerySite_name', $_POST['mr_freeGallerySite']);
- update_post_meta($post->ID, 'mr_freeGallerySite_url', $_POST['mr_freeGallerySiteUrl']);
- if($_POST['mr_freeG_website']){
- update_post_meta($post->ID, 'mr_freeG_website', $_POST['mr_freeG_website']);
- global $wpdb;
- $postTab = $wpdb->prefix."posts";
- $mr_freeG_website=$_POST['mr_freeG_website'];
- $zz = $wpdb->query( $wpdb->prepare( "UPDATE $postTab
- SET post_parent =$mr_freeG_website WHERE ID = $post->ID") );
- }
- else{
- update_post_meta($post->ID, 'mr_freeG_website', '');
- global $wpdb;
- $postTab = $wpdb->prefix."posts";
- $mr_freeG_website=$_POST['mr_freeG_website'];
- $zz = $wpdb->query( $wpdb->prepare( "UPDATE $postTab
- SET post_parent =0 WHERE ID = $post->ID") );
- }
- }
- if($post->post_type == 'freevideo')
- {
- update_post_meta($post->ID, 'video_bannercode', $_POST['video_bannercode']);
- update_post_meta($post->ID, 'video_bottomtext', $_POST['video_bottomtext']);
- update_post_meta($post->ID, 'mr_freeVideoUrl', $_POST['mr_freeVideoUrl']);
- update_post_meta($post->ID, 'mr_freeV_model', $_POST['mr_freeVideoModel']);
- update_post_meta($post->ID, 'mr_freeV_model2', $_POST['mr_freeVideoModel2']);
- if($_POST['mr_freeV_website']){
- update_post_meta($post->ID, 'mr_freeV_website', $_POST['mr_freeV_website']);
- global $wpdb;
- $postTab = $wpdb->prefix."posts";
- $mr_freeV_website=$_POST['mr_freeV_website'];
- $zz = $wpdb->query( $wpdb->prepare( "UPDATE $postTab
- SET post_parent =$mr_freeV_website WHERE ID = $post->ID") );
- }
- else{
- update_post_meta($post->ID, 'mr_freeV_website', '');
- global $wpdb;
- $postTab = $wpdb->prefix."posts";
- $mr_freeV_website=$_POST['mr_freeV_website'];
- $zz = $wpdb->query( $wpdb->prepare( "UPDATE $postTab
- SET post_parent =0 WHERE ID = $post->ID") );
- }
- }
- /* #################################### End Code #######################*/
- }
- function mr_gallerydata_sectionfun()
- {
- global $post;
- $galleryId = $post->ID;
- $galleryParent = wp_get_post_parent_id($galleryId )
- ?>
- <style type="text/css">
- .mr-add-gallery-secOut input[type="text"] {
- width: 80%;
- }
- #free-GLR-containt th { background: #000 none repeat scroll 0 0; border: 1px solid #444; color: #fff; padding: 5px;
- text-align: start;}
- #free-GLR-containt td {padding: 5px; border: 1px solid #444; }
- .free-gallery-list-out{margin-top:40px;}
- .suss-mess{text-algin:center; color:green;}
- </style>
- <div style="text-algin:center;color:green;" id="succ-mess"></div>
- <div class="mr-add-gallery-secOut">
- <a href="<?php echo get_edit_post_link($galleryParent); ?>" class="button-primary button-large">
- Go to parent post >></a>
- <br><br>
- <table width="70%" >
- <tr>
- <td>Banner Code</td>
- <td>
- <textarea style="width:100%;min-height:100px;" name="gallery_bannercode" id="gallery_bannercode" ><?php echo get_post_meta($galleryId,"gallery_bannercode",true); ?></textarea>
- </td>
- </tr>
- <tr>
- <td>Bottom Text Code</td>
- <td>
- <textarea style="width:100%;min-height:100px;" name="gallery_bottomtext" id="gallery_bottomtext" ><?php echo get_post_meta($galleryId,"gallery_bottomtext",true); ?></textarea>
- </td>
- </tr>
- <tr style="display:none;">
- <td>Site Name</td>
- <td>
- <input type="text" style="float:left; width:48%" placeholder="Enter Site Name" value="<?php echo get_post_meta($galleryId,"mr_freeGallerySite_name",true); ?>"
- name="mr_freeGallerySite" id="mr_freeGallerySite"/>
- <input type="text" name="mr_freeGallerySiteUrl" id="mr_freeGallerySiteUrl" value="<?php echo get_post_meta($galleryId,"mr_freeGallerySite_url",true); ?>" style="float:right; width:49%" placeholder="Site url" />
- </td>
- </tr>
- <tr>
- <td>Model</td>
- <td>
- <?php
- $mr_freeGalleryID =get_post_meta($galleryId,"mr_freeGalleryModel",true);
- ?>
- <select name="mr_freeGalleryModel" id="mr_freeGalleryModel">
- <option value="">Select</option>
- <?php
- $args = array('post_type' => 'model','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if($my_query->have_posts())
- {
- while($my_query->have_posts()) : $my_query->the_post();
- $model_id = get_the_ID();
- ?>
- <option <?php if($mr_freeGalleryID==$model_id){echo "selected"; }?>
- value="<?php echo $model_id; ?>"><?php echo get_the_title(); ?></option>
- <?php
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Model#2</td>
- <td>
- <?php
- $mr_freeGalleryID =get_post_meta($galleryId,"mr_freeGalleryModel_2",true);
- ?>
- <select name="mr_freeGalleryModel_2" id="mr_freeGalleryModel_2">
- <option value="">Select</option>
- <?php
- $args = array('post_type' => 'model','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if($my_query->have_posts())
- {
- while($my_query->have_posts()) : $my_query->the_post();
- $model_id = get_the_ID();
- ?>
- <option <?php if($mr_freeGalleryID==$model_id){echo "selected"; }?>
- value="<?php echo $model_id; ?>"><?php echo get_the_title(); ?></option>
- <?php
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Website</td><td>
- <?php
- $mr_freeG_website = get_post_meta($galleryId,'mr_freeG_website',true);
- ?>
- <select name="mr_freeG_website" id="mr_freeG_website">
- <option value="">Select</option>
- <?php
- $args = array('post_type' => 'post','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if($my_query->have_posts())
- {
- while($my_query->have_posts()) : $my_query->the_post();
- $web_id = get_the_ID();
- ?>
- <option <?php if($mr_freeG_website==$web_id){echo "selected"; }?>
- value="<?php echo $web_id; ?>"><?php echo get_the_title(); ?></option>
- <?php
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr>
- </table>
- </div>
- <?php
- }
- function mr_video_data_sectionfun()
- {
- global $post;
- $videoId = $post->ID;
- $videoParent = wp_get_post_parent_id($videoId )
- ?>
- <style type="text/css">
- .mr-add-video-secOut input[type="text"] {
- width: 70%;
- }
- #free-GVLR-containt th { background: #000 none repeat scroll 0 0; border: 1px solid #444; color: #fff; padding: 5px;
- text-align: start;}
- #free-GVLR-containt td {padding: 5px; border: 1px solid #444; }
- .free-gallery-video-out{margin-top:40px;}
- .video-succ-mess{text-algin:center; color:green;}
- .attachment-thumbnail.wp-post-image {
- height: 50px;
- width: 60px !important;
- } }
- </style>
- <div style="text-algin:center;color:green;" id="video-succ-mess"></div>
- <div class="mr-add-video-secOut">
- <a href="<?php echo get_edit_post_link($videoParent); ?>" class="button-primary button-large">
- Go to parent post >></a>
- <form method="post" id="freeVideofrm">
- <table width="75%" >
- <tr>
- <td>Banner Code</td>
- <td>
- <textarea style="width:100%;min-height:100px;" name="video_bannercode" id="video_bannercode" ><?php echo get_post_meta($videoId,"video_bannercode",true); ?></textarea>
- </td>
- </tr>
- <tr>
- <td>Bottom Text Code</td>
- <td>
- <textarea style="width:100%;min-height:100px;" name="video_bottomtext" id="video_bottomtext" ><?php echo get_post_meta($videoId,"video_bottomtext",true); ?></textarea>
- </td>
- </tr>
- <tr >
- <td>Free Video url</td><td>
- <input type="text" name="mr_freeVideoUrl" value="<?php echo get_post_meta($videoId,"mr_freeVideoUrl",true); ?>" id="mr_freeVideoUrl">
- </td>
- </tr>
- <tr>
- <td>Model</td><td>
- <?php
- $mr_freeVideoModelId = get_post_meta($videoId,'mr_freeV_model',true);
- ?>
- <select name="mr_freeVideoModel" id="mr_freeVideoModel">
- <option value="">Select</option>
- <?php
- $args = array('post_type' => 'model','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if($my_query->have_posts())
- {
- while($my_query->have_posts()) : $my_query->the_post();
- $model_id = get_the_ID();
- ?>
- <option <?php if($mr_freeVideoModelId==$model_id){echo "selected"; }?>
- value="<?php echo $model_id; ?>"><?php echo get_the_title(); ?></option>
- <?php
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Model#2</td><td>
- <?php $mr_freeVideoModelId = get_post_meta($videoId,'mr_freeV_model2',true); ?>
- <select name="mr_freeVideoModel2" id="mr_freeVideoModel2">
- <option value="">Select</option>
- <?php $args = array('post_type' => 'model','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if($my_query->have_posts())
- {
- while($my_query->have_posts()) : $my_query->the_post();
- $model_id = get_the_ID(); ?>
- <option <?php if($mr_freeVideoModelId==$model_id){echo "selected"; }?> value="<?php echo $model_id; ?>"><?php echo get_the_title(); ?></option> <?php endwhile; } wp_reset_query(); ?> </select> </td>
- </tr>
- <tr>
- <td>Website</td><td>
- <?php
- $mr_freeVideowebId = get_post_meta($videoId,'mr_freeV_website',true);
- ?>
- <select name="mr_freeV_website" id="mr_freeV_website">
- <option value="">Select</option>
- <?php
- $args = array('post_type' => 'post','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if($my_query->have_posts())
- {
- while($my_query->have_posts()) : $my_query->the_post();
- $web_id = get_the_ID();
- ?>
- <option <?php if($mr_freeVideowebId==$web_id){echo "selected"; }?>
- value="<?php echo $web_id; ?>"><?php echo get_the_title(); ?></option>
- <?php
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr>
- </table>
- </form>
- </div>
- <?php
- }
- /* // Free Galleries Section */
- function mr_free_galleryBox_callback()
- {
- global $post;
- $mrpostParent =$post->ID;
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function(){
- jQuery('#add_fG_Submit_reset').click(function(){
- jQuery('#mr_freeGalleryTitle').val('');
- jQuery('#gallery_bannercode').val('');
- jQuery('#mr_freeGalleryModel').val('');
- jQuery('#mr_freeGalleryModel_2').val('');
- jQuery('#mr_freeGalleryDate').val('');
- });
- jQuery("#add_freegallerySubmit").click(function()
- {
- var freeG_Title = jQuery("#mr_freeGalleryTitle").val();
- var freeG_Url = jQuery("#gallery_bannercode").val();
- var freeG_type = jQuery("#mr_freeGallery_type").val();
- var freeG_Model = jQuery("#mr_freeGalleryModel").val();
- var freeG_Model_2 = jQuery("#mr_freeGalleryModel_2").val();
- var freeG_Date = jQuery("#mr_freeGalleryDate").val();
- var freeG_image = jQuery("#mr_freeGImage").val();
- var freeG_SiteN = jQuery("#mr_freeGallerySite").val();
- var freeG_SiteUrl = jQuery("#mr_freeGallerySiteUrl").val();
- var fg_parentID ="<?php echo $post->ID; ?>";
- jQuery.ajax({
- url: "<?php echo get_template_directory_uri();?>/mr-reg-post.php",
- method: "POST",
- data: {fg_title:freeG_Title,gelley_url:freeG_Url,fg_type:freeG_type,fG_image:freeG_image,fG_Model:freeG_Model,fG_Model_2:freeG_Model_2,fG_Date:freeG_Date,fg_parentID:fg_parentID,fg_siteName:freeG_SiteN,fg_siteUrl:freeG_SiteUrl},
- success: function(result)
- {
- jQuery("#succ-mess").html(result);
- jQuery('#mr_freeGalleryTitle').val('');
- jQuery('#gallery_bannercode').val('');
- jQuery('#mr_freeGalleryModel').val('');
- jQuery('#mr_freeGalleryModel_2').val('');
- jQuery('#mr_freeGalleryDate').val('');
- jQuery('#mr_freeGImage').val('');
- jQuery('#mr_freeGallerySite').val('');
- jQuery('#mr_freeGallerySiteUrl').val('');
- }
- });
- });
- });
- </script>
- <style type="text/css">
- .mr-add-gallery-secOut input[type="text"] {
- width: 60%;
- }
- #free-GLR-containt th { background: #000 none repeat scroll 0 0; border: 1px solid #444; color: #fff; padding: 5px;
- text-align: start;}
- #free-GLR-containt td {padding: 5px; border: 1px solid #444; }
- .free-gallery-list-out{margin-top:40px;}
- .suss-mess{text-algin:center; color:green;}
- </style>
- <div style="text-algin:center;color:green;" id="succ-mess"></div>
- <div class="mr-add-gallery-secOut">
- <form method="post" id="freeGaleryfrm">
- <table width="70%" >
- <tr>
- <td widget="150px">Free gallery title</td>
- <td><input type="text" name="mr_freeGalleryTitle" id="mr_freeGalleryTitle" ></td>
- </tr>
- <tr>
- <td>Free gallery url</td>
- <td><input type="text" name="gallery_bannercode" id="gallery_bannercode" ></td>
- </tr>
- <tr>
- <td>Type</td>
- <td>
- <select name="mr_freeGallery_type" id="mr_freeGallery_type">
- <option value="video">Video</option>
- <option value="gallery">Gallery</option>
- </select>
- </td>
- </tr>
- <tr >
- <td>Site Name</td>
- <td>
- <input type="text" style="float:left; width:48%" placeholder="Enter Site Name" name="mr_freeGallerySite" id="mr_freeGallerySite"/>
- <input type="text" name="mr_freeGallerySiteUrl" id="mr_freeGallerySiteUrl" style="float:right; width:49%" placeholder="Site url" />
- </td>
- </tr>
- <tr>
- <td>Model</td>
- <td>
- <select name="mr_freeGalleryModel" id="mr_freeGalleryModel">
- <option value="">Select</option>
- <?php
- //$mr_ModelId =get_post_meta($mrpostParent,"mr_freeGalleryModel",true);
- $args = array('post_type' => 'model',
- 'post_status' => 'publish',
- 'orderby' => 'post_title',
- 'order' => 'ASC',
- 'posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() )
- {
- while ($my_query->have_posts()) : $my_query->the_post();
- $mdoel_id = get_the_ID();
- echo '<option value="'.$mdoel_id.'">'.get_the_title().'</option>';
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Model#2</td>
- <td>
- <select name="mr_freeGalleryModel_2" id="mr_freeGalleryModel_2">
- <option value="">Select</option>
- <?php /*$mr_ModelId =get_post_meta($mrpostParent,"mr_freeV_model",true);*/
- $args = array('post_type' => 'model','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if($my_query->have_posts())
- {
- while($my_query->have_posts()) : $my_query->the_post();
- $model_id = get_the_ID(); ?>
- <option <?php if($mr_ModelId==$model_id){echo "selected"; }?>
- value="<?php echo $model_id; ?>"><?php echo get_the_title(); ?>
- </option>
- <?php
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td>Enter Date</td><td><input type="text" name="mr_freeGalleryDate" id="mr_freeGalleryDate" placeholder="01/18/15"></td>
- </tr>
- <tr>
- <td valign="top">Gallery Image</td>
- <td>
- <input type="text" id="mr_freeGImage" name="mr_freeGImage" placeholder="Enter thumbnail url" style="float:left;" value="">
- <input id="btn_g1" class="button-primary upload_image_button_g" type="button" value="Upload Image" style="width:100px;float:left;" />
- </td>
- </tr>
- <tr>
- <td align="center">
- <input type="button" name="add_fG_Submit_reset" id="add_fG_Submit_reset" value="Clear" class="button button-primary button-large">
- </td>
- <td align="center">
- <input type="button" name="add_freegallerySubmit" id="add_freegallerySubmit" value="Submit" class="button button-primary button-large">
- </td>
- </tr>
- </table>
- </form>
- </div><hr>
- <div class="free-gallery-list-out">
- <?php
- global $wpdb;
- $postTab = $wpdb->prefix."posts";
- if(isset($_REQUEST['delFgpostId']))
- {
- $delFgpostId = $_REQUEST['delFgpostId'];
- $fgppdel_succ = wp_delete_post($delFgpostId,true);
- if($fgppdel_succ)
- {
- echo "<h2 class='suss-mess'>Gallery Delete successfully.</h2>";
- //wp_redirect(get_edit_post_link($mrpostParent));
- ?>
- <script type="text/javascript">
- window.location="<?php echo '?post='.$mrpostParent.'&action=edit'; ?>";
- </script>
- <?php
- }
- }
- $listFgpost =$wpdb->get_results("select * from $postTab where post_type='freegallery' and post_status='publish' and post_parent='$mrpostParent' order by ID DESC limit 0,15");
- ?>
- <div id="free-GLR-containt">
- <table width="100%" border="1" cellpadding="0" cellspacing="0">
- <thead>
- <tr><th>Gallery</th> <th>Type</th><th>Model</th><th>Site</th><th>Date</th><th width="100px">Option</th></tr>
- </thead>
- <tbody>
- <?php
- if($listFgpost && $wpdb->num_rows>0)
- {
- /* while($=mysql_fetch_array($listFgpost)) */
- foreach($listFgpost as $res)
- {
- /* extract($res); */
- ?>
- <tr>
- <td><?php echo $res->post_title; ?></td>
- <td><?php echo get_post_meta($res->ID,'mr_freeGallery_type',true); ?></td>
- <td>
- <?php
- $modelId = get_post_meta($res->ID,'mr_freeGalleryModel',true);
- $modeldetail_Data = get_post($modelId);
- $modelName = $modeldetail_Data->post_title;
- echo $modelName;
- ?></td>
- <td><?php echo get_post_meta($res->ID,'mr_freeGallerySite_name',true); ?></td>
- <td><?php echo get_post_meta($res->ID,'mr_freeGalleryDate',true); ?></td>
- <td>
- <a class="button button-primary button-small" href="<?php echo get_edit_post_link($res->ID); ?>" target="_blank">Edit</a>
- <a class="button button-primary button-small" onclick="return confirm('Are you sure want to delete ?')"
- href="?post=<?php echo $mrpostParent; ?>&action=edit&delFgpostId=<?php echo $ID; ?>">Delete</a>
- </td>
- </tr>
- <?php
- }
- }
- else{
- ?><tr><td colspan="5" align="center"><font color="red">No records</font></td></tr><?php
- }
- ?>
- <tbody>
- </table>
- </div>
- </div>
- <?php
- }
- function randon_post($post){ ?>
- <table width="75%" >
- <tr> <?php $random_post =get_post_meta($post->ID,"mr_random_post",true); ?>
- <td>Random</td>
- <td><input type="checkbox" name="mr_random_post" id="mr_random_post" value="random_post" <?php if($random_post=='random_post'){ echo "checked"; } ?> ></td>
- </tr>
- <tr> <?php $feature_video =get_post_meta($post->ID,"mr_feature_video",true); ?>
- <td> Feature Video Id </td>
- <td><input type="text" name="mr_feature_video" id="mr_feature_video" value="<?php echo $feature_video; ?>" ></td>
- </tr>
- </table>
- <?php }
- function magnifying_glass($post){ ?>
- <table width="75%" >
- <tr> <?php $random_post =get_post_meta($post->ID,"mr_magnifying_glass",true); ?>
- <td>Show Magnifying Glass</td>
- <td><input type="checkbox" name="mr_magnifying_glass" id="mr_magnifying_glass" value="magnifying_glass" <?php if($random_post=='magnifying_glass'){ echo "checked"; }?> ></td>
- </tr>
- </table>
- <?php }
- function custom_tag_fields($post){ ?>
- <table width="75%" >
- <tr> <?php $catag =get_post_meta($post->ID,"catag",true); ?>
- <td>Categ</td>
- <td><input type="text" name="catag" id="catag" value="<?php echo $catag; ?>"></td>
- </tr>
- <tr> <?php $domaintag =get_post_meta($post->ID,"domaintag",true); ?>
- <td>Domain Tag</td>
- <td><input type="text" name="domaintag" id="domaintag" value="<?php echo $domaintag; ?>"></td>
- </tr>
- <tr>
- <?php $external_link =get_post_meta($post->ID,"post_external_link",true); ?>
- <td>Post External Link</td>
- <td><input type="text" name="post_external_link" id="post_external_link" value="<?php echo $external_link; ?>"></td>
- </tr>
- <tr>
- <?php $join_external_link =get_post_meta($post->ID,"joink_external_link",true); ?>
- <td>Join External Link</td>
- <td><input type="text" name="joink_external_link" id="joink_external_link" value="<?php echo $join_external_link; ?>"></td>
- </tr>
- <tr> <?php $titletag =htmlspecialchars(get_post_meta($post->ID,"titletag",true)) ; ?>
- <td>Title Tag</td>
- <td><input type="text" name="titletag" id="titletag" value="<?php echo $titletag; ?>"></td>
- </tr>
- </table>
- <style>
- #mr-extra_tag-section input {
- width: 350px;
- }
- </style>
- <?php }
- function discount_extra_sites($post){
- ?>
- <div class="discount-extra-site">
- <p>Select Extra Discounted Sites</p>
- <?php
- $sites_discounted = get_post_meta( $post->ID, 'discount-extra-site', true );
- ?>
- <Select name="discount-extra-site[]" multiple >
- <?php
- query_posts( 'post_type=post&orderby=title&order=ASC' );
- while ( have_posts() ) : the_post(); ?>
- <option value="<?php the_ID(); ?>" <?php if (@in_array(get_the_ID(), $sites_discounted)){ echo "selected";
- } ?> ><?php the_title(); ?></option>
- <?php endwhile; ?>
- </select>
- </div>
- <?php
- }
- function feature_box_fields($post){ ?>
- <table width="75%">
- <tr>
- <td widget="150px">Feature 1</td>
- <td><input type="text" class="full-width" name="mr_feature1" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"mr_feature1",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Feature 2</td>
- <td><input type="text" class="full-width" name="mr_feature2" id="mr_feature2" value="<?php echo get_post_meta($post->ID,"mr_feature2",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Feature 3</td>
- <td><input type="text" class="full-width" name="mr_feature3" id="mr_feature3" value="<?php echo get_post_meta($post->ID,"mr_feature3",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Feature 4</td>
- <td><input type="text" class="full-width" name="mr_feature4" id="mr_feature4" value="<?php echo get_post_meta($post->ID,"mr_feature4",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Feature 5</td>
- <td><input type="text" class="full-width" name="mr_feature5" id="mr_feature5" value="<?php echo get_post_meta($post->ID,"mr_feature5",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Feature 6</td>
- <td><input type="text" class="full-width" name="mr_feature6" id="mr_feature6" value="<?php echo get_post_meta($post->ID,"mr_feature6",true); ?>"></td>
- </tr>
- </table>
- <?php }
- function price_table_fields($post){
- ?>
- <table width="75%" >
- <tr><th></th><th>Price</th><th>Off</th><th>Last Price</th><th>Per Month</th></tr>
- <tr>
- <td widget="150px">Per Month</td>
- <td><input type="text" name="mr_month_price" id="mr_month_price" value="<?php echo get_post_meta($post->ID,"mr_month_price",true); ?>"></td>
- <td><input type="text" name="mr_month_off" id="mr_month_off" value="<?php echo get_post_meta($post->ID,"mr_month_off",true); ?>"></td>
- <td><input type="text" name="mr_month_lastrice" id="mr_month_lastrice" value="<?php echo get_post_meta($post->ID,"mr_month_lastrice",true); ?>"></td>
- <td><input type="text" name="mr_month_price_2" id="mr_month_price_2" value="<?php echo get_post_meta($post->ID,"mr_month_price",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Per 3 Months</td>
- <td><input type="text" name="mr_sixmonth_price" id="mr_sixmonth_price" value="<?php echo get_post_meta($post->ID,"mr_sixmonth_price",true); ?>"></td>
- <td><input type="text" name="mr_sixmonth_off" id="mr_sixmonth_off" value="<?php echo get_post_meta($post->ID,"mr_sixmonth_off",true); ?>"></td>
- <td><input type="text" name="mr_sixmonth_lastrice" id="mr_sixmonth_lastrice" value="<?php echo get_post_meta($post->ID,"mr_sixmonth_lastrice",true); ?>"></td>
- <td><input type="text" name="mr_per_month3" id="mr_per_month3" value="<?php echo get_post_meta($post->ID,"mr_per_month3",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Per 6 Months</td>
- <td><input type="text" name="mr_threeyear_price" id="mr_threeyear_price" value="<?php echo get_post_meta($post->ID,"mr_threeyear_price",true); ?>"></td>
- <td><input type="text" name="mr_threeyear_off" id="mr_threeyear_off" value="<?php echo get_post_meta($post->ID,"mr_threeyear_off",true); ?>"></td>
- <td><input type="text" name="mr_threeyear_lastrice" id="mr_threeyear_lastrice" value="<?php echo get_post_meta($post->ID,"mr_threeyear_lastrice",true); ?>"></td>
- <td><input type="text" name="mr_per_month6" id="mr_per_month6" value="<?php echo get_post_meta($post->ID,"mr_per_month6",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Per 1 Year</td>
- <td><input type="text" name="mr_fiveyear_price" id="mr_fiveyear_price" value="<?php echo get_post_meta($post->ID,"mr_fiveyear_price",true); ?>"></td>
- <td><input type="text" name="mr_fiveyear_off" id="mr_fiveyear_off" value="<?php echo get_post_meta($post->ID,"mr_fiveyear_off",true); ?>"></td>
- <td><input type="text" name="mr_fiveyear_lastrice" id="mr_fiveyear_lastrice" value="<?php echo get_post_meta($post->ID,"mr_fiveyear_lastrice",true); ?>"></td>
- <td><input type="text" name="mr_per_month12" id="mr_per_month12" value="<?php echo get_post_meta($post->ID,"mr_per_month12",true); ?>"></td>
- </tr>
- </table>
- <?php
- }
- function discount_price_fields($post){ ?>
- <table width="75%" >
- <tr> <?php $active_discount =get_post_meta($post->ID,"mr_active_discount",true);
- $top_deal_discount =get_post_meta($post->ID,"mr_topdeal_discount",true);
- $lifetime_discount =get_post_meta($post->ID,"mr_lifetime_discount",true);
- $new_discount =get_post_meta($post->ID,"mr_new_discount",true); ?>
- <td>Active</td>
- <td><input type="checkbox" name="mr_active_discount" id="mr_active_discount" value="active" <?php if($active_discount=='active'){ echo "checked"; }?> ></td>
- </tr>
- <tr>
- <td>Top Deal</td>
- <td><input type="checkbox" name="mr_topdeal_discount" id="mr_topdeal_discount" value="top_deal" <?php if($top_deal_discount=='top_deal'){ echo "checked"; }?>></td>
- </tr>
- <tr>
- <td>New</td>
- <td><input type="checkbox" name="mr_new_discount" id="mr_new_discount" value="new" <?php if($new_discount=='new'){ echo "checked"; }?>></td>
- </tr>
- <tr>
- <td>Lifetime Discount</td>
- <td><input type="checkbox" name="mr_lifetime_discount" id="mr_lifetime_discount" value="lifetime"<?php if($lifetime_discount=='lifetime'){ echo "checked"; }?> ></td>
- </tr>
- <!--<tr>
- <td widget="150px">Old Price</td>
- <td><input type="text" name="mr_regularprice" id="mr_regularprice" value="<?php echo get_post_meta($post->ID,"mr_regularprice",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">New Price</td>
- <td><input type="text" name="mr_saleprice" id="mr_saleprice" value="<?php echo get_post_meta($post->ID,"mr_saleprice",true); ?>"></td>
- </tr>
- <tr>
- <td widget="150px">Discount %</td>
- <td><input type="text" name="mr_discountprice" id="mr_discountprice" value="<?php echo get_post_meta($post->ID,"mr_discountprice",true); ?>" ></td>
- </tr> -->
- <tr>
- <td>Description</td>
- <td><textarea class="full-width" name="mr_discount_des" size="25" id="mr_discount_des"><?php echo get_post_meta($post->ID,"mr_discount_des",true); ?></textarea></td>
- </tr>
- <tr>
- <td valign="top">Discount Image</td>
- <td> <input type="text" value="<?php echo get_post_meta($post->ID,"mr_discount_Image",true); ?>" style="float:left;" placeholder="Enter thumbnail url" name="mr_discount_Image" id="mr_discount_Image"> <input type="button" style="width:100px;float:left;" value="Upload Image" class="button-primary upload_image_button_d" id="btn_2"> </td>
- </tr>
- <tr>
- <td widget="150px">Buy Now Button Url</td>
- <td><input type="text" name="mr_discountbutton_url" id="mr_discountbutton_url" value="<?php echo get_post_meta($post->ID,"mr_discountbutton_url",true); ?>"></td>
- </tr>
- </table>
- <?php }
- function more_born_sites($post){ ?>
- <table>
- <tr>More Born Sites</tr>
- <tr><td>CategoryID 1</td>
- <td><input type="text" name="site_id1" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id1",true); ?>"></td>
- </tr>
- <tr><td>CategoryID 2</td>
- <td><input type="text" name="site_id2" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id2",true); ?>"></td>
- </tr>
- <tr><td>CategoryID 3</td>
- <td><input type="text" name="site_id3" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id3",true); ?>"></td>
- </tr>
- <tr><td>CategoryID 4</td>
- <td><input type="text" name="site_id4" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id4",true); ?>"></td>
- </tr>
- <tr><td>CategoryID 5</td>
- <td><input type="text" name="site_id5" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id5",true); ?>"></td>
- </tr>
- <tr><td>CategoryID 6</td>
- <td><input type="text" name="site_id6" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id6",true); ?>"></td>
- </tr>
- <tr><td>CategoryID 7</td>
- <td><input type="text" name="site_id7" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id7",true); ?>"></td>
- </tr>
- <tr><td>CategoryID 8</td>
- <td><input type="text" name="site_id8" id="mr_feature1" value="<?php echo get_post_meta($post->ID,"site_id8",true); ?>"></td>
- </tr>
- </table>
- <?php }
- function post_extra_desc($post){
- ?>
- <style>
- .full-width {
- width: 100%;
- }
- </style>
- <table width="100%" >
- <tr>
- <td>Pros</td>
- <td><textarea class="full-width" name="mr_quility_des" size="25" id="mr_quility_des"><?php echo get_post_meta($post->ID,"mr_quility_des",true); ?></textarea>
- </td>
- </tr>
- <tr>
- <td>Cons</td>
- <td><textarea class="full-width" name="mr_content_des" size="25" id="mr_content_des"><?php echo get_post_meta($post->ID,"mr_content_des",true); ?></textarea>
- </td>
- </tr>
- <!--
- <tr>
- <td>Pros</td>
- <td><textarea name="mr_pros_des" size="25" id="mr_pros_des"><?php // echo get_post_meta($post->ID,"mr_pros_des",true); ?></textarea>
- </td>
- </tr>
- <tr>
- <td>Cons</td>
- <td><textarea name="mr_cons_des" size="25" id="mr_cons_des"><?php // echo get_post_meta($post->ID,"mr_cons_des",true); ?></textarea>
- </td>
- </tr>
- <tr>
- <td>Price $ Bonus</td>
- <td><textarea name="mr_pb_des" size="25" id="mr_pb_des"><?php // echo get_post_meta($post->ID,"mr_pb_des",true); ?></textarea>
- </td>
- </tr>
- <tr>
- <td>Conclusion</td>
- <td><textarea name="mr_conclusion_des" size="25" id="mr_conclusion_des"><?php // echo get_post_meta($post->ID,"mr_conclusion_des",true); ?></textarea>
- </td>
- </tr>
- -->
- </table>
- <?php
- }
- /* //Free Videos Sections */
- function mr_free_videoBox_callback($post)
- {
- global $wpdb;
- $postTab = $wpdb->prefix."posts";
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function(){
- //Clear from
- jQuery('#add_fV_Submit_reset').click(function(){
- jQuery('#mr_freeVideoTitle').val('');
- jQuery('#video_content').val('');
- jQuery('#mr_freeVideoUrl').val('');
- jQuery('#mr_freeImage_type').val('');
- });
- jQuery("#add_freeVideoSubmit").click(function()
- {
- var freeV_Title = jQuery("#mr_freeVideoTitle").val(); var freeV_Content = jQuery("#video_content").val();
- var freeV_Url = jQuery("#mr_freeVideoUrl").val();
- var freeV_image = jQuery("#mr_freeVImage").val();
- var freeV_model = jQuery("#mr_freeVideoModel").val();
- var freeV_model2 = jQuery("#mr_freeVideoModel_2").val();
- var fv_parentID ="<?php echo $post->ID; ?>";
- jQuery.ajax({
- url: "<?php echo get_template_directory_uri();?>/mr-reg-post.php",
- method: "POST",
- data: {fv_title:freeV_Title,fV_Content:freeV_Content,fvideo_url:freeV_Url,fV_image:freeV_image,fV_model:freeV_model,fV_model2:freeV_model2,fv_parentID:fv_parentID},
- success: function(mr_result)
- {
- jQuery("#video-succ-mess").html(mr_result);
- jQuery('#mr_freeVideoTitle').val('');
- jQuery('#video_content').val('');
- jQuery('#mr_freeVideoUrl').val('');
- jQuery('#mr_freeVImage').val('');
- jQuery('#mr_freeVideoModel').val('');
- jQuery('#mr_freeVideoModel_2').val('');
- }
- });
- });
- });
- jQuery(document).ready(function() {
- var formfield;
- jQuery('.upload_image_button').click(function() {
- jQuery('html').addClass('Image');
- formfield = jQuery(this).prev().attr('id');
- tb_show('', 'media-upload.php?type=image&TB_iframe=true');
- return false;
- });
- window.original_send_to_editor = window.send_to_editor;
- window.send_to_editor = function(html){
- if (formfield)
- {
- fileurl = jQuery('img',html).attr('src');
- jQuery('#mr_freeVImage').val(fileurl);
- tb_remove();
- jQuery('html').removeClass('Image');
- }
- else {
- window.original_send_to_editor(html);
- }
- };
- });
- jQuery(document).ready(function() {
- var formfield;
- jQuery('.upload_image_button_g').click(function() {
- jQuery('html').addClass('Image');
- formfield = jQuery(this).prev().attr('id');
- tb_show('', 'media-upload.php?type=image&TB_iframe=true');
- return false;
- });
- window.original_send_to_editor = window.send_to_editor;
- window.send_to_editor = function(html){
- if (formfield)
- {
- fileurl = jQuery('img',html).attr('src');
- jQuery('#mr_freeGImage').val(fileurl);
- tb_remove();
- jQuery('html').removeClass('Image');
- }
- else {
- window.original_send_to_editor(html);
- }
- };
- }); jQuery(document).ready(function() { var formfield; jQuery('.upload_image_button_d').click(function() { jQuery('html').addClass('Image'); formfield = jQuery(this).prev().attr('id'); tb_show('', 'media-upload.php?type=image&TB_iframe=true'); return false; }); window.original_send_to_editor = window.send_to_editor; window.send_to_editor = function(html){ if (formfield) { fileurl = jQuery('img',html).attr('src'); jQuery('#mr_discount_Image').val(fileurl); tb_remove(); jQuery('html').removeClass('Image'); } else { window.original_send_to_editor(html); } }; });
- </script>
- <style type="text/css">
- .mr-add-video-secOut input[type="text"] {
- width: 70%;
- }
- #free-GVLR-containt th { background: #000 none repeat scroll 0 0; border: 1px solid #444; color: #fff; padding: 5px;
- text-align: start;}
- #free-GVLR-containt td {padding: 5px; border: 1px solid #444; }
- .free-gallery-video-out{margin-top:40px;}
- .video-succ-mess{text-algin:center; color:green;}
- .attachment-thumbnail.wp-post-image {
- height: 50px;
- width: 60px !important;
- }
- </style>
- <div style="text-algin:center;color:green;" id="video-succ-mess"></div>
- <div class="mr-add-video-secOut">
- <form method="post" id="freeVideofrm">
- <table width="75%" >
- <tr>
- <td widget="150px">Free Video title</td>
- <td><input type="text" name="mr_freeVideoTitle" id="mr_freeVideoTitle"></td>
- </tr>
- <tr style="display:none;">
- <td>Free Video url</td><td><input type="text" name="mr_freeVideoUrl" id="mr_freeVideoUrl"></td>
- </tr>
- <tr>
- <td valign="top">Video Image</td>
- <td>
- <input type="text" id="mr_freeVImage" name="mr_freeVImage" placeholder="Enter thumbnail url" style="float:left;" value="">
- <input id="btn_1" class="button-primary upload_image_button" type="button" value="Upload Image" style="width:100px;float:left;" />
- </td>
- </tr>
- <tr>
- <td>Model</td>
- <td>
- <select name="mr_freeVideoModel" id="mr_freeVideoModel">
- <option value="">Select</option>
- <?php
- $args = array('post_type' => 'model',
- 'post_status' => 'publish',
- 'orderby' => 'post_title',
- 'order' => 'ASC',
- 'posts_per_page' => -1);
- $my_query = null;
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() )
- {
- while ($my_query->have_posts()) : $my_query->the_post();
- $mdoel_id = get_the_ID();
- echo '<option value="'.$mdoel_id.'">'.get_the_title().'</option>';
- endwhile;
- }
- wp_reset_query();
- ?>
- </select>
- </td>
- </tr> <tr> <td>Model#2</td> <td> <select name="mr_freeVideoModel_2" id="mr_freeVideoModel_2"> <option value="">Select</option> <?php $mr_ModelId =get_post_meta($mrpostParent,"mr_freeV_model",true); $args = array('post_type' => 'model','post_status' => 'publish','orderby' => 'post_title','order' => 'ASC','posts_per_page' => -1); $my_query = null; $my_query = new WP_Query($args); if($my_query->have_posts()) { while($my_query->have_posts()) : $my_query->the_post(); $model_id = get_the_ID(); ?> <option <?php if($mr_ModelId==$model_id){echo "selected"; }?> value="<?php echo $model_id; ?>"><?php echo get_the_title(); ?></option> <?php endwhile; } wp_reset_query(); ?> </select> </td> </tr> <tr> <td>Video Content</td><td><textarea id="video_content" size="25" name="video_content" ></textarea></td> </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
- <td align="center">
- <input type="button" name="add_fV_Submit_reset" id="add_fV_Submit_reset" value="Clear" class="button button-primary button-large">
- </td>
- <td align="center">
- <input type="button" name="add_freeVideoSubmit" id="add_freeVideoSubmit" value="Add Video" class="button button-primary button-large">
- </td>
- </tr>
- </table>
- </form>
- </div><hr>
- <div class="free-video-list-out">
- <?php
- if(isset($_REQUEST['delFVpostId']))
- {
- $delFVpostId = $_REQUEST['delFVpostId'];
- $fVppdel_succ = wp_delete_post($delFVpostId,true);
- if($fVppdel_succ)
- {
- echo "<h2 class='suss-mess'>Gallery Delete successfully.</h2>";
- ?>
- <script type="text/javascript">
- window.location="<?php echo '?post='.$post->ID.'&action=edit'; ?>";
- </script>
- <?php
- }
- }
- $listFVpost =$wpdb->get_results("select * from $postTab where post_type='freevideo' and post_status='publish' and post_parent='$post->ID' order by ID DESC limit 0,15");
- ?>
- <div id="free-GVLR-containt">
- <table width="70%" border="1" cellpadding="0" cellspacing="0">
- <thead>
- <tr><th>Video Image</th><th>Video Title</th><th>Model</th><th>Model#2</th><th width="100px">Option</th></tr>
- </thead>
- <tbody>
- <?php
- if($listFVpost && $wpdb->num_rows>0)
- {
- foreach($listFVpost as $res)
- {
- $videoThum = get_the_post_thumbnail($res->ID,"thumbnail");
- ?>
- <tr>
- <td><?php echo $videoThum; ?></td>
- <td><?php echo $res->post_title; ?></td>
- <td><?php
- $modelId = get_post_meta($res->ID,'mr_freeV_model',true);
- $modeldetail_Data = get_post($modelId);
- $modelName = $modeldetail_Data->post_title;
- echo $modelName;
- ?></td> <td><?php $modelId = get_post_meta($res->ID,'mr_freeV_model2',true); $modeldetail_Data = get_post($modelId); $modelName = $modeldetail_Data->post_title; echo $modelName; ?></td>
- <td width="">
- <a class="button button-primary button-small" href="<?php echo get_edit_post_link($res->ID); ?>" target="_blank">Edit</a>
- <a class="button button-primary button-small" onclick="return confirm('Are you sure want to delete ?')"
- href="?post=<?php echo $post->ID; ?>&action=edit&delFVpostId=<?php echo $res->ID; ?>">Delete</a>
- </td>
- </tr>
- <?php
- }
- }
- else{
- ?><tr><td colspan="5" align="center"><font color="red">No records</font></td></tr><?php
- }
- ?>
- <tbody>
- </table>
- </div>
- </div>
- <?php
- }
- /* INCLUDE PAGINATION FUNCTION */
- require_once("dz_pagination_function.php");
- /**
- * Disable the emoji's
- */
- function disable_emojis() {
- remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
- remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
- remove_action( 'wp_print_styles', 'print_emoji_styles' );
- remove_action( 'admin_print_styles', 'print_emoji_styles' );
- remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
- remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
- remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
- add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
- }
- add_action( 'init', 'disable_emojis' );
- /**
- * Filter function used to remove the tinymce emoji plugin.
- *
- * @param array $plugins
- * @return array Difference betwen the two arrays
- */
- function disable_emojis_tinymce( $plugins ) {
- if ( is_array( $plugins ) ) {
- return array_diff( $plugins, array( 'wpemoji' ) );
- } else {
- return array();
- }
- }
- /* DISABLE GENERICONS */
- function dequeue_my_css() {
- wp_dequeue_style('genericons');
- wp_deregister_style('genericons');
- }
- add_action('wp_enqueue_scripts','dequeue_my_css', 100);
- /* PAGESPEED webphp */
- /* REMOVE ADMIN BAR */
- //show_admin_bar(false);
- //add_filter(‘show_admin_bar’, ‘__return_false’);
- /* PAGESPEED webphp */
- remove_filter('sanitize_title', 'sanitize_title_with_dashes');
- function sanitize_title_with_dots_and_dashes($title) {
- $title = strip_tags($title); $title = preg_replace('|%([a-fA-F0-9][a-fA-F0-9])|', '---$1---', $title); $title = str_replace('%', '', $title);
- $title = preg_replace('|---([a-fA-F0-9][a-fA-F0-9])---|', '%$1', $title);
- $title = remove_accents($title);
- if (seems_utf8($title)) {
- if (function_exists('mb_strtolower')) {
- $title = mb_strtolower($title, 'UTF-8');
- }
- $title = utf8_uri_encode($title);
- }
- $title = strtolower($title);
- $title = preg_replace('/&.+?;/', '', $title); // kill entities
- $title = preg_replace('/[^%a-z0-9 ._-]/', '', $title);
- $title = preg_replace('/\s+/', '-', $title);
- $title = preg_replace('|-+|', '-', $title);
- $title = trim($title, '-');
- $title = str_replace('-.-', '.', $title);
- $title = str_replace('-.', '.', $title);
- $title = str_replace('.-', '.', $title);
- $title = preg_replace('|([^.])\.$|', '$1', $title);
- $title = trim($title, '-');
- return $title;
- }
- add_filter('sanitize_title', 'sanitize_title_with_dots_and_dashes');
- add_theme_support( 'post-thumbnails', array( 'post', 'portfolio-items', 'slider-items', 'testimonial-items', ) );
- add_image_size( 'slider-larger', 958, 460 );
- add_image_size( 'slider-thumb', 195, 90 );
- add_image_size( 'portfolio-thumb', 220, 180 );
- add_image_size( 'author-thumb', 200, 200 );
- add_image_size( 'freeGallery', 240, 360 );
- add_image_size( 'galleryhover', 240, 360, true );
- add_image_size( 'galleryhome', 123, 183, true );
- add_image_size( 'bornstarshome', 152, 229, true );
- //add_image_size( 'videoshome', 198, 111, true );
- add_image_size( 'videoshome', 415, 233, true );
- add_image_size( 'gallerypage', 215, 321, true );
- /**
- * Extend WordPress search to include custom fields
- *
- * http://adambalee.com
- */
- /**
- * Join posts and postmeta tables
- *
- * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_join
- */
- function cf_search_join( $join ) {
- global $wpdb;
- if ( is_search() ) {
- $join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';
- }
- return $join;
- }
- add_filter('posts_join', 'cf_search_join' );
- /**
- * Modify the search query with posts_where
- *
- * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where
- */
- function cf_search_where( $where ) {
- global $pagenow, $wpdb;
- if ( is_search() ) {
- $where = preg_replace(
- "/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
- "(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_value LIKE $1)", $where );
- }
- return $where;
- }
- add_filter( 'posts_where', 'cf_search_where' );
- /**
- * Prevent duplicates
- *
- * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_distinct
- */
- function cf_search_distinct( $where ) {
- global $wpdb;
- if ( is_search() ) {
- return "DISTINCT";
- }
- return $where;
- }
- add_filter( 'posts_distinct', 'cf_search_distinct' );
- function wpb_set_post_views($postID) {
- $count_key = 'wpb_post_views_count';
- $count = get_post_meta($postID, $count_key, true);
- if($count==''){
- $count = 0;
- delete_post_meta($postID, $count_key);
- add_post_meta($postID, $count_key, '0');
- }else{
- $count++;
- update_post_meta($postID, $count_key, $count);
- }}
- function wpb_track_post_views ($post_id) {
- if ( !is_single() ) return;
- if ( empty ( $post_id) ) {
- global $post;
- $post_id = $post->ID;
- }
- wpb_set_post_views($post_id);}
- add_action( 'wp_head', 'wpb_track_post_views');
- function wpb_get_post_views($postID){ $count_key = 'wpb_post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); return "0 View"; } return $count.' Views';}
- add_filter( 'posts_where', 'title_like_posts_where', 10, 2 );
- function title_like_posts_where( $where, &$wp_query ) {
- global $wpdb;
- if ( $post_title_like = $wp_query->get( 'post_title_like' ) ) {
- $where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'' . esc_sql( $wpdb->esc_like( $post_title_like ) ) . '%\''; }
- return $where;
- }
- add_action('wp_enqueue_scripts', 'se_wp_enqueue_scripts');
- function se_wp_enqueue_scripts() {
- wp_enqueue_script('suggest');
- }
- add_action('wp_head', 'se_wp_head');
- function se_wp_head() {
- ?>
- <script type="text/javascript">
- var se_ajax_url = '<?php echo admin_url('admin-ajax.php'); ?>';
- jQuery(document).ready(function() {
- jQuery('#search-input').suggest(se_ajax_url + '?action=se_lookup');
- });
- </script>
- <style>
- .ac_results > li {
- padding: 5px 20px;
- }
- .ac_results {
- background: #fff none repeat scroll 0 0;
- color: #000;
- max-width: 300px;
- position: absolute !important;
- width: 80%;
- z-index: 2147483647;
- padding:0;
- }
- .ac_results > li:hover {
- background: #981d67 none repeat scroll 0 0;
- color: #fff;
- }
- </style>
- <?php
- }
- add_action('wp_ajax_se_lookup', 'se_lookup');
- add_action('wp_ajax_nopriv_se_lookup', 'se_lookup');
- function se_lookup() {
- global $wpdb;
- $postTab = $wpdb->prefix."posts";
- $postMeta = $wpdb->prefix."postmeta";
- $search = like_escape($_REQUEST['q']);
- $query = 'SELECT ID,post_title FROM ' . $wpdb->posts . '
- WHERE post_title LIKE \'%' . $search . '%\'
- AND post_type = \'model\'
- AND post_status = \'publish\'
- ORDER BY post_title ASC';
- foreach ($wpdb->get_results($query) as $row) {
- $post_title = $row->post_title;
- $id = $row->ID;
- echo $post_title. "\n";
- }
- $query1 = "select * from $postTab as a,$postMeta as b where a.ID=b.post_id and a.post_type='model' and a.post_status='publish' and
- b.meta_key='aka' and b.meta_value LIKE \"%" . $search . "%\"
- ORDER BY post_title ASC";
- /* echo $query1; */
- $full_list=array();
- foreach ($wpdb->get_results($query1) as $row1) {
- $post_title = $row1->post_title;
- $id = $row1->ID;
- $meta = get_post_meta($id, 'aka', TRUE);
- $pieces = explode(",", $meta);
- $full_list=array_merge($full_list,$pieces);
- }
- $efull_list=array_unique($full_list);
- $arrlength = count($efull_list);
- for($x = 0; $x < $arrlength; $x++) {
- if (preg_match('/'.$search.'/i',$efull_list[$x])){
- echo $efull_list[$x]. "\n";
- }
- }
- die();
- }
- function mytheme_comment($comment, $args, $depth) {
- $GLOBALS['comment'] = $comment;
- if($depth>1)
- { ?>
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
- <div id="comment-<?php comment_ID(); ?>">
- <div class="comment-author vcard reply_com">
- <?php /* echo get_avatar($comment,$size='48',$default='<path_to_url>' ); */ ?>
- <?php printf(__('<strong class="fn"><span class="says">Reply From </span>%s</strong>'), get_comment_author_link()) ?>
- <?php printf(__('(Date: %1$s): '), get_comment_date()) ?>
- </div>
- <?php if ($comment->comment_approved == '0') : ?>
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
- <br />
- <?php endif; ?>
- <?php comment_text() ?>
- </div>
- </li>
- <?php
- }
- else{ ?>
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
- <div id="comment-<?php comment_ID(); ?>">
- <div class="comment-author vcard ">
- <?php /* echo get_avatar($comment,$size='48',$default='<path_to_url>' ); */ ?>
- <?php printf(__('<span class="says">Comment by: </span><strong class="fn">%s</strong>'), get_comment_author_link()) ?>
- </div>
- <?php if ($comment->comment_approved == '0') : ?>
- <em><?php _e('Your comment is awaiting moderation.') ?></em>
- <br />
- <?php endif; ?>
- <div class="comment-meta commentmetadata">
- <?php $scores=get_comment_meta( $comment->comment_ID, 'score', $single = false );
- echo 'Score: <span class="blue_box">'.$scores[0]."</span>";
- ?>
- <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('Date: %1$s'), get_comment_date()) ?></a><?php edit_comment_link(__('(Edit)'),' ','') ?></div>
- <?php comment_text() ?>
- <?php if ( current_user_can( 'manage_options' ) ) { ?>
- <div class="reply1">
- <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
- </div>
- <?php } ?>
- </div>
- </li>
- <?php
- }
- }
- add_action( 'comment_form_logged_in_after', 'additional_fields' );
- add_action( 'comment_form_after_fields', 'additional_fields' );
- function additional_fields () {
- if(isset($_GET['replytocom'])){
- }
- else{
- echo '<p style="color:red;display:none;" id="required_com">*All fields are required</p><p class="small_content">* Please include a pro and a con about the site.Balance is essential in making a comment worthwhile<br />* Watch out the ratings of zero and 100.In our opinion, there is no such thing as a site that is absolutely perfect and completely worthless.</p><p class="comment-form-score">'.
- /*'<label for="Score">'. __('Score') . '<span class="required">*</span></label>*/
- ' <fieldset><div class="perDrop"><select id="select_score" name="score" required><option value="">Select Score</option> ';
- $i=0;
- while( $i <= 100 ){
- if($i==0){
- echo '<option id="score" value="1%"/>1%</option>';
- }
- else{
- echo '<option id="score" value="'. $i .'%"/>'. $i .'%</option>';
- }
- $i=$i+10;
- }
- echo'</select></div>';
- if ( is_user_logged_in() ) {
- echo '<input id="com_email" placeholder="Email" name="com_email" type="text" size="30" tabindex="5" required />';
- echo '<input id="agree_check" name="agree_check" type="checkbox" size="30" /><label for="agree_check">' . __( 'I am human' ) . '</label></fieldset>';
- }
- else{
- echo
- '<input id="agree_check" name="agree_check" type="checkbox" size="30" /><label for="agree_check">' . __( 'I am human' ) . '</label></fieldset>';
- }
- }
- }
- add_action('comment_post', 'save_comment_meta_data', 10, 2);
- function save_comment_meta_data( $comment_id ) {
- ;
- if ( ( isset( $_POST['com_email'] ) ) && ( $_POST['com_email'] != '') ){
- $com_email = wp_filter_nohtml_kses($_POST['com_email']);
- add_comment_meta( $comment_id, 'com_email', $com_email );
- }
- if ( ( isset( $_POST['score'] ) ) && ( $_POST['score'] != '') ){
- $score = wp_filter_nohtml_kses($_POST['score']);
- add_comment_meta( $comment_id, 'score', $score );
- }
- }
- add_filter( 'preprocess_comment', 'verify_comment_meta_data' );
- function verify_comment_meta_data( $commentdata ) {
- if ( ( !isset( $_POST['score'] ) ) || ( $_POST['score'] == '') ){
- wp_die( __( 'Error: You did not add a Score. Hit the Back button on your Web browser and resubmit your comment with a Score.' ) );
- }
- if ( ( !isset( $_POST['agree_check'] ) ) || ( $_POST['agree_check'] == '') ){
- wp_die( __( 'Error: Please check I am human. Hit the Back button on your Web browser and resubmit your comment by checking I am human.' ) );
- }
- return $commentdata;
- }
- /*
- function wpb_move_comment_field_to_bottom( $fields ) {
- $comment_field = $fields['comment'];
- unset( $fields['comment'] );
- $fields['comment'] = $comment_field;
- return $fields;
- }
- add_filter( 'comment_form_fields', 'wpb_move_comment_field_to_bottom' ); */
- //excerpt limit
- function excerpt($num) {
- $limit = $num+1;
- $excerpt = explode(' ', get_the_excerpt(), $limit);
- array_pop($excerpt);
- $excerpt = implode(" ",$excerpt)."...";
- echo $excerpt;
- }
- //enable comment all
- function discount_price($post){ ?>
- <table width="100%" >
- <tr>
- <td>Show category ID</td>
- <td>
- <input type="text" name="show_cat1" id="show_cat1" value="<?php echo get_post_meta($post->ID,"show_cat1",true); ?>">
- </td>
- <td>
- <input type="text" name="show_cat2" id="show_cat2" value="<?php echo get_post_meta($post->ID,"show_cat2",true); ?>">
- </td>
- <td>
- <input type="text" name="show_cat3" id="show_cat3" value="<?php echo get_post_meta($post->ID,"show_cat3",true); ?>">
- </td>
- <td>
- <input type="text" name="show_cat4" id="show_cat4" value="<?php echo get_post_meta($post->ID,"show_cat4",true); ?>">
- </td>
- </tr>
- </table>
- <?php }
- add_action( 'add_meta_boxes', 'property_area' );
- function property_area()
- {
- add_meta_box('pr-details-section','Show category','discount_price','page', 'normal', 'high');
- }
- add_action('save_post', 'save_property_data');
- function save_property_data(){
- global $post;
- if($post->post_type == 'page')
- {
- update_post_meta($post->ID, 'show_cat1', $_POST['show_cat1']);
- update_post_meta($post->ID, 'show_cat2', $_POST['show_cat2']);
- update_post_meta($post->ID, 'show_cat3', $_POST['show_cat3']);
- update_post_meta($post->ID, 'show_cat4', $_POST['show_cat4']);
- }
- }
- function today_offer($post){
- ?><table width="20%"style="margin-bottom:30px;" >
- <tr>
- <?php $active_discount=get_post_meta ($post->ID,"today_offer",true); ?>
- <td>Add to today offer</td>
- <td><input type="checkbox" name="today_offer" id="today_offer" value="offer"<?php if($active_discount=='offer'){ echo "checked"; }?> ></td>
- </td>
- </tr>
- </table>
- <?php }
- function search_script_footer(){ ?>
- <script type="text/javascript">
- jQuery(document).ready(function(){
- jQuery("#search_result").hide();
- jQuery('#search-box-header').keyup(function(){
- var value= jQuery(this).val();
- var filter= jQuery('#filter-search').val();
- var length=jQuery(this).val().length;
- if(length>3){
- jQuery.ajax({
- url: "<?php echo get_template_directory_uri();?>/custom_search.php",
- method: "POST",
- data: {search_v:value,filter:filter},
- success: function(mr_result)
- {
- jQuery("#search_result").html(mr_result);
- jQuery("#search_result").show();
- }
- });
- }
- else{
- jQuery("#search_result").hide();
- }
- });
- jQuery('#searchTypes .all').click(function(){
- jQuery('#search_form').attr('action','https://bestborn.com');
- jQuery('#searchTypeSelected i').attr('class','all');
- jQuery('#search-box-header').attr('name','s');
- jQuery('#filter-search').val('all');
- jQuery('#searchTypes').hide();
- });
- jQuery('#searchTypes .review').click(function(){
- jQuery('#search_form').attr('action','https://bestborn.com/latest-reviews');
- jQuery('#searchTypeSelected i').attr('class','review');
- jQuery('#search-box-header').attr('name','search');
- jQuery('#filter-search').val('review');
- jQuery('#searchTypes').hide();
- });
- jQuery('#searchTypes .video').click(function(){
- jQuery('#search_form').attr('action','https://bestborn.com/videos');
- jQuery('#searchTypeSelected i').attr('class','video');
- jQuery('#search-box-header').attr('name','search');
- jQuery('#filter-search').val('video');
- jQuery('#searchTypes').hide();
- });
- jQuery('#searchTypes .bornstars').click(function(){
- jQuery('#search_form').attr('action','https://bestborn.com/bornstars');
- jQuery('#searchTypeSelected i').attr('class','bornstars');
- jQuery('#search-box-header').attr('name','search');
- jQuery('#filter-search').val('bornstars');
- jQuery('#searchTypes').hide();
- });
- jQuery('#searchTypes .photos').click(function(){
- jQuery('#search_form').attr('action','https://bestborn.com/galleries');
- jQuery('#searchTypeSelected i').attr('class','photos');
- jQuery('#search-box-header').attr('name','search');
- jQuery('#filter-search').val('photos');
- jQuery('#searchTypes').hide();
- });
- jQuery('#searchTypes .discounts').click(function(){
- jQuery('#search_form').attr('action','https://bestborn.com/discounts');
- jQuery('#searchTypeSelected i').attr('class','discounts');
- jQuery('#search-box-header').attr('name','search');
- jQuery('#filter-search').val('discounts');
- jQuery('#searchTypes').hide();
- });
- jQuery('#searchTypes .blog').click(function(){
- jQuery('#search_form').attr('action','https://bestborn.com/blog');
- jQuery('#searchTypeSelected i').attr('class','blog');
- jQuery('#search-box-header').attr('name','search');
- jQuery('#filter-search').val('blog');
- jQuery('#searchTypes').hide();
- });
- jQuery('#searchTypeSelected').click(function(){
- jQuery('#searchTypes').toggle();
- });
- jQuery( "body" ).on( "click", ".show_more", function() {
- var action=jQuery(this).attr('action-data');
- jQuery('#search-box-header').attr('name','search');
- jQuery('#search_form').attr('action','https://bestborn.com/'+action);
- jQuery("#search_form").submit();
- });
- });
- </script>
- <?php }
- add_action('wp_footer', 'search_script_footer',100 );
- function title_filter( $where, &$wp_query )
- {
- global $wpdb;
- if ( $search_term = $wp_query->get( 'search_prod_title' ) ) {
- $where .= ' AND ' . $wpdb->posts . '.post_title LIKE \'%' . esc_sql( like_escape( $search_term ) ) . '%\'';
- }
- return $where;
- }
- add_filter( 'posts_where', 'title_filter', 10, 2 );
- function video_ecxep($post){ ?>
- <table width="100%" >
- <tr>
- <td>
- <textarea name="video_exc" id="show_cat1" value="<?php echo get_post_meta($post->ID,"video_exc",true); ?>"style="width:100%;"></textarea>
- </td>
- </tr>
- </table>
- <?php }
- add_action( 'add_meta_boxes', 'property_area8' );
- function property_area8()
- {
- add_meta_box('pr-details-section','Excerpt','video_ecxep','freevideo', 'normal', 'high');
- }
- add_action('save_post', 'save_property_data8');
- function save_property_data8(){
- global $post;
- if($post->post_type == 'freevideo')
- {
- update_post_meta($post->ID, 'video_exc', $_POST['video_exc']);
- }
- }
- /*
- * Creating a function to create our CPT
- */
- function register_cgif() {
- $labels = array(
- 'name' =>'Gifs',
- 'singular_name' =>'Gif',
- 'menu_name' =>'Gifs',
- 'name_admin_bar' =>'Gifs',
- 'add_new' =>'Add New',
- 'add_new_item' =>'Add New GIF',
- 'new_item' =>'New GIF',
- 'edit_item' =>'Edit Gif',
- 'view_item' =>'View Gif',
- 'all_items' =>'All Gif',
- 'search_items' =>'Search Gif',
- 'parent_item_colon' =>'Parent Gif',
- 'not_found' =>'No Models found.',
- 'not_found_in_trash' =>'No Models found in Trash.'
- );
- $args = array(
- 'labels' => $labels,
- 'description' =>'Description.',
- 'public' => true,
- 'publicly_queryable' => true,
- 'show_ui' => true,
- 'show_in_menu' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'gif', 'with_front' => FALSE ),
- 'capability_type' => 'post',
- 'has_archive' => true,
- 'hierarchical' => false,
- 'menu_position' => 8,
- 'supports' => array( 'title','thumbnail','editor','comments')
- );
- register_post_type( 'gif', $args );
- }
- add_action( 'init', 'register_cgif');
- function custom_rating_image_extension() {
- return 'png';
- }
- add_filter( 'wp_postratings_image_extension', 'custom_rating_image_extension' );
- function filter_plugin_updates( $value ) {
- unset( $value->response['wp-postratings/wp-postratings.php'] );
- return $value;
- }
- add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
- function create_posttypes() {
- register_post_type( 'modelsuggestion',
- // CPT Options
- array(
- 'labels' => array(
- 'name' => __( 'Model Suggestions ' ),
- 'singular_name' => __( 'suggestion' )
- ),
- 'public' => true,
- 'rewrite' => array('slug' => 'suggestion'),
- 'supports' => array('title','thumbnail','revisions')
- )
- );
- }
- add_action('wp_login', 'set_last_login');
- function set_last_login($login) {
- $user = get_userdatabylogin($login);
- update_usermeta( $user->ID, 'last_login', current_time('mysql') );
- }
- function get_last_login($user_id) {
- $last_login = get_user_meta($user_id, 'last_login', true);
- $date_format = get_option('date_format') . ' ' . get_option('time_format');
- $the_last_login = mysql2date($date_format, $last_login, false);
- return $the_last_login;
- }
- function bimber_mycred_sort_badges_by_order( $a, $b ) {
- $a = get_post_field( 'menu_order', $a );
- $b = get_post_field( 'menu_order', $b );
- if ( $a == $b ) {
- return 0;
- }
- return ( $a < $b ) ? -1 : 1;
- }
- ?>