Ejemplo n.º 1
0
 function cftpb_term_the_meta($term_id, $taxonomy)
 {
     global $post;
     $term_post = cf_taxonomy_post_type_binding::get_term_post($term_id, $taxonomy);
     if (!empty($term_post) && !is_wp_error($term_post)) {
         $pre_post_state = $post;
         $post = $term_post;
         the_meta();
         $post = $pre_post_state;
     }
 }
Ejemplo n.º 2
0
	/**
	 * Display the post content with a link to the single post
	 * @since 1.0.0
	 */
	function storefront_post_content() {
		?>
		<div class="entry-content" itemprop="articleBody">
		<?php
		storefront_post_thumbnail( 'full' );
		the_meta();
		the_content(
			sprintf(
				__( 'Continue reading %s', 'storefront' ),
				'<span class="screen-reader-text">' . get_the_title() . '</span>'
			)
		);

		wp_link_pages( array(
			'before' => '<div class="page-links">' . __( 'Pages:', 'storefront' ),
			'after'  => '</div>',
		) );
		?>
		</div><!-- .entry-content -->
		<?php
	}
Ejemplo n.º 3
0
function contents_cfinfobox()
{
    //set up variables
    $pageid = get_the_ID();
    //get page ID
    $objectfetch = get_option("widget_cfinfobox");
    //object types from setting
    $objectposttype = $objectfetch['posttype'];
    $objectkeyword = $objectfetch['category'];
    $objectelsetext = $objectfetch['elsetext'];
    $ancestorarray = get_ancestors($pageid, $objectposttype);
    //foreach($ancestorarray as $ancestor){
    //echo $ancestor}
    //do they match?)
    if (in_array($objectkeyword, $ancestorarray)) {
        echo '<h3>' . get_the_title() . '</h3>';
        //display page title
        echo '<p>' . the_meta() . '</p>';
    } else {
        echo $objectelsetext;
    }
}
Ejemplo n.º 4
0
  <h1><?php 
        the_title();
        ?>
</h1>
  <div id="music"></div>
  <div class="entry">
    <?php 
        the_content('<p>leggi il seguito... &raquo;</p>');
        ?>
   
<div style="font-size:18px; color:#000"><?php 
        echo get_post_meta($post->ID, 'data', true);
        ?>
</div>
<?php 
        the_meta();
        ?>

    <?php 
        wp_link_pages(array('before' => '<p><strong>' . __('Pagine:', 'kubrick') . '</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
        ?>
  <?php 
    }
}
?>



</div>  
</div>
<div class="clearall"></div>
        function insertPages_handleShortcode_insert($atts, $content = null)
        {
            global $wp_query, $post, $wp_current_filter;
            // Shortcode attributes.
            $attributes = shortcode_atts(array('page' => '0', 'display' => 'all', 'class' => '', 'inline' => false), $atts);
            // Validation checks.
            if ($attributes['page'] === '0') {
                return $content;
            }
            // Trying to embed same page in itself.
            if (!is_null($post) && property_exists($post, 'ID') && ($attributes['page'] == $post->ID || $attributes['page'] == $post->post_name)) {
                return $content;
            }
            // Get options set in WordPress dashboard (Settings > Insert Pages).
            $options = get_option('wpip_settings');
            if ($options === FALSE || !is_array($options) || !array_key_exists('wpip_format', $options) || !array_key_exists('wpip_wrapper', $options) || !array_key_exists('wpip_insert_method', $options)) {
                $options = wpip_set_defaults();
            }
            $attributes['inline'] = $attributes['inline'] !== false && $attributes['inline'] !== 'false' || array_search('inline', $atts) === 0 || array_key_exists('wpip_wrapper', $options) && $options['wpip_wrapper'] === 'inline';
            /**
             * Filter the flag indicating whether to wrap the inserted content in inline tags (span).
             *
             * @param bool $use_inline_wrapper Indicates whether to wrap the content in span tags.
             */
            $attributes['inline'] = apply_filters('insert_pages_use_inline_wrapper', $attributes['inline']);
            $attributes['wrapper_tag'] = $attributes['inline'] ? 'span' : 'div';
            $attributes['should_apply_the_content_filter'] = true;
            /**
             * Filter the flag indicating whether to apply the_content filter to post
             * contents and excerpts that are being inserted.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $attributes['should_apply_the_content_filter'] = apply_filters('insert_pages_apply_the_content_filter', $attributes['should_apply_the_content_filter']);
            // Disable the_content filter if using inline tags, since wpautop
            // inserts p tags and we can't have any inside inline elements.
            if ($attributes['inline']) {
                $attributes['should_apply_the_content_filter'] = false;
            }
            $attributes['should_apply_nesting_check'] = true;
            /**
             * Filter the flag indicating whether to apply deep nesting check
             * that can prevent circular loops. Note that some use cases rely
             * on inserting pages that themselves have inserted pages, so this
             * check should be disabled for those individuals.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $attributes['should_apply_nesting_check'] = apply_filters('insert_pages_apply_nesting_check', $attributes['should_apply_nesting_check']);
            // Don't allow inserted pages to be added to the_content more than once (prevent infinite loops).
            if ($attributes['should_apply_nesting_check']) {
                $done = false;
                foreach ($wp_current_filter as $filter) {
                    if ('the_content' == $filter) {
                        if ($done) {
                            return $content;
                        } else {
                            $done = true;
                        }
                    }
                }
            }
            // Get the WP_Post object from the provided slug or ID.
            if (!is_numeric($attributes['page'])) {
                // Get list of post types that can be inserted (page, post, custom
                // types), excluding builtin types (nav_menu_item, attachment).
                $insertable_post_types = array_filter(get_post_types(), create_function('$type', 'return ! in_array( $type, array( "nav_menu_item", "attachment" ) );'));
                $inserted_page = get_page_by_path($attributes['page'], OBJECT, $insertable_post_types);
                $attributes['page'] = $inserted_page ? $inserted_page->ID : $attributes['page'];
            } else {
                $inserted_page = get_post(intval($attributes['page']));
            }
            // Use "Normal" insert method (get_post()).
            if ($options['wpip_insert_method'] !== 'legacy') {
                // If we couldn't retrieve the page, fire the filter hook showing a not-found message.
                if ($inserted_page === null) {
                    /**
                     * Filter the html that should be displayed if an inserted page was not found.
                     *
                     * @param string $content html to be displayed. Defaults to an empty string.
                     */
                    $content = apply_filters('insert_pages_not_found_message', $content);
                    // Short-circuit since we didn't find the page.
                    return $content;
                }
                // Start output buffering so we can save the output to a string.
                ob_start();
                // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
                // Note: Temporarily set the global $post->ID to the inserted page ID,
                // since Beaver Builder relies on it to load the appropriate styles.
                if (class_exists('FLBuilder')) {
                    // If we're not in The Loop (i.e., global $post isn't assigned),
                    // temporarily populate it with the post to be inserted so we can
                    // retrieve Beaver Builder styles for that post. Reset $post to null
                    // after we're done.
                    if (is_null($post)) {
                        $old_post_id = null;
                        $post = $inserted_page;
                    } else {
                        $old_post_id = $post->ID;
                        $post->ID = $inserted_page->ID;
                    }
                    FLBuilder::enqueue_layout_styles_scripts($inserted_page->ID);
                    if (is_null($old_post_id)) {
                        $post = null;
                    } else {
                        $post->ID = $old_post_id;
                    }
                }
                // Show either the title, link, content, everything, or everything via a custom template
                // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
                // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
                // are only getting called once. The fix here is to disable processing of filters on the_content in
                // the inserted page. @see https://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage
                switch ($attributes['display']) {
                    case "title":
                        $title_tag = $attributes['inline'] ? 'span' : 'h1';
                        echo "<{$title_tag} class='insert-page-title'>";
                        echo get_the_title($inserted_page->ID);
                        echo "</{$title_tag}>";
                        break;
                    case "link":
                        ?>
<a href="<?php 
                        echo esc_url(get_permalink($inserted_page->ID));
                        ?>
"><?php 
                        echo get_the_title($inserted_page->ID);
                        ?>
</a><?php 
                        break;
                    case "excerpt":
                        ?>
<h1><a href="<?php 
                        echo esc_url(get_permalink($inserted_page->ID));
                        ?>
"><?php 
                        echo get_the_title($inserted_page->ID);
                        ?>
</a></h1><?php 
                        echo $this->insertPages_trim_excerpt(get_post_field('post_excerpt', $inserted_page->ID), $inserted_page->ID, $attributes['should_apply_the_content_filter']);
                        break;
                    case "excerpt-only":
                        echo $this->insertPages_trim_excerpt(get_post_field('post_excerpt', $inserted_page->ID), $inserted_page->ID, $attributes['should_apply_the_content_filter']);
                        break;
                    case "content":
                        $content = get_post_field('post_content', $inserted_page->ID);
                        if ($attributes['should_apply_the_content_filter']) {
                            $content = apply_filters('the_content', $content);
                        }
                        echo $content;
                        break;
                    case "all":
                        // Title.
                        $title_tag = $attributes['inline'] ? 'span' : 'h1';
                        echo "<{$title_tag} class='insert-page-title'>";
                        echo get_the_title($inserted_page->ID);
                        echo "</{$title_tag}>";
                        // Content.
                        $content = get_post_field('post_content', $inserted_page->ID);
                        if ($attributes['should_apply_the_content_filter']) {
                            $content = apply_filters('the_content', $content);
                        }
                        echo $content;
                        // Meta.
                        // @ref https://core.trac.wordpress.org/browser/tags/4.4/src/wp-includes/post-template.php#L968
                        if ($keys = get_post_custom_keys($inserted_page->ID)) {
                            echo "<ul class='post-meta'>\n";
                            foreach ((array) $keys as $key) {
                                $keyt = trim($key);
                                if (is_protected_meta($keyt, 'post')) {
                                    continue;
                                }
                                $values = array_map('trim', get_post_custom_values($key));
                                $value = implode($values, ', ');
                                /**
                                 * Filter the HTML output of the li element in the post custom fields list.
                                 *
                                 * @since 2.2.0
                                 *
                                 * @param string $html  The HTML output for the li element.
                                 * @param string $key   Meta key.
                                 * @param string $value Meta value.
                                 */
                                echo apply_filters('the_meta_key', "<li><span class='post-meta-key'>{$key}:</span> {$value}</li>\n", $key, $value);
                            }
                            echo "</ul>\n";
                        }
                        break;
                    default:
                        // display is either invalid, or contains a template file to use
                        // Legacy/compatibility code: In order to use custom templates,
                        // we use query_posts() to provide the template with the global
                        // state it requires for the inserted page (in other words, all
                        // template tags will work with respect to the inserted page
                        // instead of the parent page / main loop). Note that this may
                        // cause some compatibility issues with other plugins.
                        // @ref https://codex.wordpress.org/Function_Reference/query_posts
                        if (is_numeric($attributes['page'])) {
                            $args = array('p' => intval($attributes['page']), 'post_type' => get_post_types());
                        } else {
                            $args = array('name' => esc_attr($attributes['page']), 'post_type' => get_post_types());
                        }
                        $inserted_page = query_posts($args);
                        if (have_posts()) {
                            $template = locate_template($attributes['display']);
                            if (strlen($template) > 0) {
                                include $template;
                                // execute the template code
                            } else {
                                // Couldn't find template, so fall back to printing a link to the page.
                                the_post();
                                ?>
<a href="<?php 
                                the_permalink();
                                ?>
"><?php 
                                the_title();
                                ?>
</a><?php 
                            }
                        }
                        wp_reset_query();
                }
                // Save output buffer contents.
                $content = ob_get_clean();
                // Use "Legacy" insert method (query_posts()).
            } else {
                // Construct query_posts arguments.
                if (is_numeric($attributes['page'])) {
                    $args = array('p' => intval($attributes['page']), 'post_type' => get_post_types());
                } else {
                    $args = array('name' => esc_attr($attributes['page']), 'post_type' => get_post_types());
                }
                $posts = query_posts($args);
                if (have_posts()) {
                    // Start output buffering so we can save the output to string
                    ob_start();
                    // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
                    // Note: Temporarily set the global $post->ID to the inserted page ID,
                    // since Beaver Builder relies on it to load the appropriate styles.
                    if (class_exists('FLBuilder')) {
                        // If we're not in The Loop (i.e., global $post isn't assigned),
                        // temporarily populate it with the post to be inserted so we can
                        // retrieve Beaver Builder styles for that post. Reset $post to null
                        // after we're done.
                        if (is_null($post)) {
                            $old_post_id = null;
                            $post = $inserted_page;
                        } else {
                            $old_post_id = $post->ID;
                            $post->ID = $inserted_page->ID;
                        }
                        FLBuilder::enqueue_layout_styles_scripts($inserted_page->ID);
                        if (is_null($old_post_id)) {
                            $post = null;
                        } else {
                            $post->ID = $old_post_id;
                        }
                    }
                    // Show either the title, link, content, everything, or everything via a custom template
                    // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
                    // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
                    // are only getting called once. The fix here is to disable processing of filters on the_content in
                    // the inserted page. @see https://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage
                    switch ($attributes['display']) {
                        case "title":
                            the_post();
                            $title_tag = $attributes['inline'] ? 'span' : 'h1';
                            echo "<{$title_tag} class='insert-page-title'>";
                            the_title();
                            echo "</{$title_tag}>";
                            break;
                        case "link":
                            the_post();
                            ?>
<a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a><?php 
                            break;
                        case "excerpt":
                            the_post();
                            ?>
<h1><a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></h1><?php 
                            if ($attributes['should_apply_the_content_filter']) {
                                the_excerpt();
                            } else {
                                echo get_the_excerpt();
                            }
                            break;
                        case "excerpt-only":
                            the_post();
                            if ($attributes['should_apply_the_content_filter']) {
                                the_excerpt();
                            } else {
                                echo get_the_excerpt();
                            }
                            break;
                        case "content":
                            the_post();
                            if ($attributes['should_apply_the_content_filter']) {
                                the_content();
                            } else {
                                echo get_the_content();
                            }
                            break;
                        case "all":
                            the_post();
                            $title_tag = $attributes['inline'] ? 'span' : 'h1';
                            echo "<{$title_tag} class='insert-page-title'>";
                            the_title();
                            echo "</{$title_tag}>";
                            if ($attributes['should_apply_the_content_filter']) {
                                the_content();
                            } else {
                                echo get_the_content();
                            }
                            the_meta();
                            break;
                        default:
                            // display is either invalid, or contains a template file to use
                            $template = locate_template($attributes['display']);
                            if (strlen($template) > 0) {
                                include $template;
                                // execute the template code
                            } else {
                                // Couldn't find template, so fall back to printing a link to the page.
                                the_post();
                                ?>
<a href="<?php 
                                the_permalink();
                                ?>
"><?php 
                                the_title();
                                ?>
</a><?php 
                            }
                            break;
                    }
                    // Save output buffer contents.
                    $content = ob_get_clean();
                } else {
                    /**
                     * Filter the html that should be displayed if an inserted page was not found.
                     *
                     * @param string $content html to be displayed. Defaults to an empty string.
                     */
                    $content = apply_filters('insert_pages_not_found_message', $content);
                }
                wp_reset_query();
            }
            /**
             * Filter the markup generated for the inserted page.
             *
             * @param string $content The post content of the inserted page.
             * @param object $inserted_page The post object returned from querying the inserted page.
             * @param array $attributes Extra parameters modifying the inserted page.
             *   page: Page ID or slug of page to be inserted.
             *   display: Content to display from inserted page.
             *   class: Extra classes to add to inserted page wrapper element.
             *   inline: Boolean indicating wrapper element should be a span.
             *   should_apply_nesting_check: Whether to disable nested inserted pages.
             *   should_apply_the_content_filter: Whether to apply the_content filter to post contents and excerpts.
             *   wrapper_tag: Tag to use for the wrapper element (e.g., div, span).
             */
            $content = apply_filters('insert_pages_wrap_content', $content, $inserted_page, $attributes);
            return $content;
        }
// WP_Query arguments
$args = array('post_type' => array('latest-activity'), 'meta_query' => array(array('key' => 'activity')));
// The Query
$latest_activity = new WP_Query($args);
if ($latest_activity->have_posts()) {
    ?>

    <!-- the loop -->
    <?php 
    while ($latest_activity->have_posts()) {
        $latest_activity->the_post();
        ?>
        <div class="col-sm-6 col-md-3">
            <div class="iframe-respo">
                <?php 
        the_meta('activity');
        ?>
            </div>
        </div>
    <?php 
    }
    ?>
    <!-- end of the loop -->

    <?php 
    wp_reset_postdata();
    wp_reset_query();
    ?>

<?php 
} else {
Ejemplo n.º 7
0
        function insertPages_handleShortcode_insert($atts, $content = null)
        {
            global $wp_query, $post, $wp_current_filter;
            extract(shortcode_atts(array('page' => '0', 'display' => 'all', 'class' => ''), $atts));
            // Validation checks.
            if ($page === '0') {
                return $content;
            }
            // Trying to embed same page in itself.
            if ($page == $post->ID || $page == $post->post_name) {
                return $content;
            }
            $should_apply_nesting_check = true;
            /**
             * Filter the flag indicating whether to apply deep nesting check
             * that can prevent circular loops. Note that some use cases rely
             * on inserting pages that themselves have inserted pages, so this
             * check should be disabled for those individuals.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $should_apply_nesting_check = apply_filters('insert_pages_apply_nesting_check', $should_apply_nesting_check);
            // Don't allow inserted pages to be added to the_content more than once (prevent infinite loops).
            if ($should_apply_nesting_check) {
                $done = false;
                foreach ($wp_current_filter as $filter) {
                    if ('the_content' == $filter) {
                        if ($done) {
                            return $content;
                        } else {
                            $done = true;
                        }
                    }
                }
            }
            // Get page object from slug or id
            $temp_query = clone $wp_query;
            // we're starting a new loop within the main loop, so save the main query
            $temp_post = $wp_query->get_queried_object();
            // see: http://codex.wordpress.org/The_Loop#Multiple_Loops_Example_2
            // Convert slugs to page IDs to standardize query_posts() lookup below.
            if (!is_numeric($page)) {
                $page_object = get_page_by_path($page, OBJECT, get_post_types());
                $page = $page_object ? $page_object->ID : $page;
            }
            if (is_numeric($page)) {
                $args = array('p' => intval($page), 'post_type' => get_post_types());
            } else {
                $args = array('name' => esc_attr($page), 'post_type' => get_post_types());
            }
            query_posts($args);
            $should_apply_the_content_filter = true;
            /**
             * Filter the flag indicating whether to apply the_content filter to post
             * contents and excerpts that are being inserted.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $should_apply_the_content_filter = apply_filters('insert_pages_apply_the_content_filter', $should_apply_the_content_filter);
            // Start our new Loop (only iterate once).
            if (have_posts()) {
                ob_start();
                // Start output buffering so we can save the output to string
                // Show either the title, link, content, everything, or everything via a custom template
                // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
                // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
                // are only getting called once. The fix here is to disable processing of filters on the_content in
                // the inserted page. @see https://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage
                switch ($display) {
                    case "title":
                        the_post();
                        ?>
					<h1><?php 
                        the_title();
                        ?>
</h1>
					<?php 
                        break;
                    case "link":
                        the_post();
                        ?>
					<a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_title();
                        ?>
</a>
					<?php 
                        break;
                    case "excerpt":
                        the_post();
                        ?>
					<h1><a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h1>
					<?php 
                        if ($should_apply_the_content_filter) {
                            the_excerpt();
                        } else {
                            echo get_the_excerpt();
                        }
                        ?>
					<?php 
                        break;
                    case "excerpt-only":
                        the_post();
                        ?>
					<?php 
                        if ($should_apply_the_content_filter) {
                            the_excerpt();
                        } else {
                            echo get_the_excerpt();
                        }
                        ?>
					<?php 
                        break;
                    case "content":
                        the_post();
                        ?>
					<?php 
                        if ($should_apply_the_content_filter) {
                            the_content();
                        } else {
                            echo get_the_content();
                        }
                        ?>
					<?php 
                        break;
                    case "all":
                        the_post();
                        ?>
					<h1><?php 
                        the_title();
                        ?>
</h1>
					<?php 
                        if ($should_apply_the_content_filter) {
                            the_content();
                        } else {
                            echo get_the_content();
                        }
                        ?>
					<?php 
                        the_meta();
                        ?>
					<?php 
                        break;
                    default:
                        // display is either invalid, or contains a template file to use
                        $template = locate_template($display);
                        if (strlen($template) > 0) {
                            include $template;
                            // execute the template code
                        } else {
                            // Couldn't find template, so fall back to printing a link to the page.
                            the_post();
                            ?>
						<a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a><?php 
                        }
                        break;
                }
                $content = ob_get_contents();
                // Save off output buffer
                ob_end_clean();
                // End output buffering
            }
            wp_reset_postdata();
            $wp_query = clone $temp_query;
            // Restore main Loop's wp_query
            $post = $temp_post;
            $content = "<div data-post-id='{$page}' class='insert-page insert-page-{$page} {$class}'>{$content}</div>";
            return $content;
            //return do_shortcode($content); // careful: watch for infinite loops with nested inserts
        }
Ejemplo n.º 8
0
function bfa_postinfo($postinfo_string)
{
    // one theme option needed below for nofollow trackback / RSS links yes/no
    global $bfa_ata, $post;
    /* replace date format escape placeholders(#) with the actual escpae
    	character (=backslashes). This function removes all backslashes from
    	post info strings to avoid issues with hosts that have magic_quotes_gpc ON.
    	But we want to keep the backslashes inside date items, because they are
    	needed to escape literal strings inside dates */
    $postinfo_string = str_replace("#", "\\", $postinfo_string);
    $postinfo = $postinfo_string;
    // Author public name
    if (strpos($postinfo_string, '%author%') !== FALSE) {
        ob_start();
        the_author();
        $author = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author%", $author, $postinfo);
    }
    // Public name of Author who last modified a post, since WordPress 2.8.
    // Check first if function is available (= if this is WP 2.8+)
    if (function_exists('the_modified_author')) {
        if (strpos($postinfo_string, '%modified-author%') !== FALSE) {
            ob_start();
            the_modified_author();
            $modified_author = ob_get_contents();
            ob_end_clean();
            $postinfo = str_replace("%modified-author%", $modified_author, $postinfo);
        }
    }
    // Author about yourself
    if (strpos($postinfo_string, '%author-description%') !== FALSE) {
        ob_start();
        the_author_meta('description');
        $author_description = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-description%", $author_description, $postinfo);
    }
    // Author login name
    if (strpos($postinfo_string, '%author-login%') !== FALSE) {
        ob_start();
        the_author_meta('user_login');
        $author_login = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-login%", $author_login, $postinfo);
    }
    // Author first name
    if (strpos($postinfo_string, '%author-firstname%') !== FALSE) {
        ob_start();
        the_author_meta('first_name');
        $author_firstname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-firstname%", $author_firstname, $postinfo);
    }
    // Author last name
    if (strpos($postinfo_string, '%author-lastname%') !== FALSE) {
        ob_start();
        the_author_meta('last_name');
        $author_lastname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-lastname%", $author_lastname, $postinfo);
    }
    // Author nickname
    if (strpos($postinfo_string, '%author-nickname%') !== FALSE) {
        ob_start();
        the_author_meta('nickname');
        $author_nickname = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-nickname%", $author_nickname, $postinfo);
    }
    // Author ID
    if (strpos($postinfo_string, '%author-id%') !== FALSE) {
        ob_start();
        the_author_meta('ID');
        $author_ID = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-id%", $author_ID, $postinfo);
    }
    // Author email address, clear text in HTML source code
    if (strpos($postinfo_string, '%author-email-clear%') !== FALSE) {
        ob_start();
        the_author_meta('email');
        $author_email_clear = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-email-clear%", $author_email_clear, $postinfo);
    }
    // Author email address obfuscated
    if (strpos($postinfo_string, '%author-email%') !== FALSE) {
        $postinfo = str_replace("%author-email%", antispambot(get_the_author_email()), $postinfo);
    }
    // Author website URL
    if (strpos($postinfo_string, '%author-url%') !== FALSE) {
        ob_start();
        the_author_meta('url');
        $author_url = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-url%", $author_url, $postinfo);
    }
    // Author website link
    if (strpos($postinfo_string, '%author-link%') !== FALSE) {
        ob_start();
        the_author_link();
        $author_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-link%", $author_link, $postinfo);
    }
    // Author posts archive link
    if (strpos($postinfo_string, '%author-posts-link%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-posts-link%", $author_posts_link, $postinfo);
    }
    //  LEGACY: %author-linked% replaced by %author-posts-link% in 3.3.2, but displays the same: Author posts archive link
    if (strpos($postinfo_string, '%author-linked%') !== FALSE) {
        ob_start();
        the_author_posts_link();
        $author_posts_link = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-linked%", $author_posts_link, $postinfo);
    }
    // Author post count
    if (strpos($postinfo_string, '%author-post-count%') !== FALSE) {
        ob_start();
        the_author_posts();
        $author_post_count = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-post-count%", $author_post_count, $postinfo);
    }
    // Author AOL Instant Messenger screenname
    if (strpos($postinfo_string, '%author-aim%') !== FALSE) {
        ob_start();
        the_author_meta('aim');
        $author_aim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-aim%", $author_aim, $postinfo);
    }
    // Author Yahoo IM ID
    if (strpos($postinfo_string, '%author-yim%') !== FALSE) {
        ob_start();
        the_author_meta('yim');
        $author_yim = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%author-yim%", $author_yim, $postinfo);
    }
    // Date & Time
    if (strpos($postinfo_string, '%date(') !== FALSE) {
        $postinfo = preg_replace_callback("/%date\\((.*?)'(.*?)'(.*?)\\)%/is", "bfa_parse_date_callback", $postinfo);
    }
    // Date & Time, last modified
    if (strpos($postinfo_string, '%date-modified(') !== FALSE) {
        $postinfo = preg_replace_callback("/%date-modified\\((.*?)'(.*?)'(.*?)\\)%/is", "bfa_parse_date_modified_callback", $postinfo);
    }
    // Tags, linked - since WP 2.3
    if (strpos($postinfo_string, '%tags-linked') !== FALSE) {
        while (strpos($postinfo, '%tags-linked') !== FALSE) {
            $tag_link_options = preg_match("/(.*)%tags-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
            $tags_linked = get_the_tag_list($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
            $postinfo = preg_replace("/(.*)%tags-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_linked . "\${3}", $postinfo);
        }
    }
    // Tags, linked. If post has no tags, categories are displayed instead -  since WP 2.3
    if (strpos($postinfo_string, '%tags-cats-linked') !== FALSE) {
        while (strpos($postinfo, '%tags-cats-linked') !== FALSE) {
            $tag_link_options = preg_match("/(.*)%tags-cats-linked\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_link_matches);
            ob_start();
            the_tags($tag_link_matches[2], $tag_link_matches[4], $tag_link_matches[6]);
            $tags_cats_linked = ob_get_contents();
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%tags-cats-linked\\((.*?)\\)%(.*)/i", "\${1}" . $tags_cats_linked . "\${3}", $postinfo);
        }
    }
    // Tags, not linked - since WP 2.3
    if (strpos($postinfo_string, '%tags(') !== FALSE) {
        while (strpos($postinfo, '%tags(') !== FALSE) {
            $tag_options = preg_match("/(.*)%tags\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $tag_matches);
            $posttags = get_the_tags();
            if ($posttags) {
                foreach ($posttags as $tag) {
                    $tag_list .= $tag->name . $tag_matches[4];
                }
                // remove last separator
                $tag_list = preg_replace("/" . $tag_matches[4] . "\$/mi", "", $tag_list);
                $tags = $tag_matches[2] . $tag_list . $tag_matches[6];
            } else {
                $tags = "";
            }
            $postinfo = preg_replace("/(.*)%tags\\((.*?)\\)%(.*)/i", "\${1}" . $tags . "\${3}", $postinfo);
        }
    }
    // 1st category
    if (strpos($postinfo_string, '%category%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_notlinked = $category;
        $postinfo = str_replace("%category%", $category_notlinked, $postinfo);
    }
    // 1st category, linked
    if (strpos($postinfo_string, '%category-linked%') !== FALSE) {
        $all_categories = get_the_category();
        $category = $all_categories[0]->cat_name;
        $category_linked = '<a class="' . $category . '" href="' . get_category_link($all_categories[0]->cat_ID) . '">' . $category . '</a>';
        $postinfo = str_replace("%category-linked%", $category_linked, $postinfo);
    }
    // Categories, linked with class name added
    $categories_linked = '';
    if (strpos($postinfo_string, '%categories-linked') !== FALSE) {
        while (strpos($postinfo, '%categories-linked') !== FALSE) {
            $category_linked_separator = preg_match("/(.*)%categories-linked\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_linked_matches);
            ob_start();
            $categories = get_the_category();
            $items_in_categories = count($categories);
            $output = '';
            $categories_count = $items_in_categories;
            if ($categories) {
                foreach ($categories as $category) {
                    $categories_count -= 1;
                    if ($categories_count) {
                        $seperator = $category_linked_matches[2];
                    } else {
                        $seperator = '';
                    }
                    $categories_linked .= '<a class="' . $category->slug . '" href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s"), $category->name)) . '">' . $category->cat_name . $seperator . '</a>';
                }
            }
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%categories-linked\\((.*?)\\)%(.*)/i", "\${1}" . $categories_linked . "\${3}", $postinfo);
        }
    }
    // Categories, not linked
    if (strpos($postinfo_string, '%categories(') !== FALSE) {
        while (strpos($postinfo, '%categories(') !== FALSE) {
            $category_separator = preg_match("/(.*)%categories\\('(.*?)'\\)(.*)/i", $postinfo_string, $category_matches);
            $categories = "";
            foreach (get_the_category() as $category) {
                $categories .= $category->cat_name . $category_matches[2];
            }
            // remove last separator
            $categories = preg_replace("/" . $category_matches[2] . "\$/mi", "", $categories);
            $postinfo = preg_replace("/(.*)%categories\\((.*?)\\)%(.*)/i", "\${1}" . $categories . "\${3}", $postinfo);
        }
    }
    // Comment link
    if (strpos($postinfo_string, '%comments(') !== FALSE) {
        while (strpos($postinfo, '%comments(') !== FALSE) {
            $comment_options = preg_match("/(.*)%comments\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $comment_matches);
            if (!comments_open() and $comment_matches[8] == "dontshow") {
                $comment_link = '';
            } else {
                ob_start();
                comments_popup_link($comment_matches[2], $comment_matches[4], $comment_matches[6], 'comments-link', $comment_matches[8]);
                $comment_link = ob_get_contents();
                ob_end_clean();
            }
            if (!comments_open()) {
                if ($post->comment_count == 0) {
                    $comment_link = '<strong>' . $comment_matches[8] . '</strong>';
                } else {
                    $comment_link = $comment_link . ' - <strong>(' . $comment_matches[8] . ')</strong>';
                }
            }
            if (!comments_open() and $comment_matches[8] == "dontshow") {
                $comment_link = '';
            }
            $postinfo = preg_replace("/(.*)%comments\\((.*?)\\)%(.*)/i", "\${1}" . $comment_link . "\${3}", $postinfo);
        }
    }
    // Comments Feed link
    if (strpos($postinfo_string, '%comments-rss') !== FALSE) {
        while (strpos($postinfo, '%comments-rss') !== FALSE) {
            $comments_rss_link_text = preg_match("/(.*)%comments-rss\\('(.*?)'(.*)/i", $postinfo_string, $comments_rss_matches);
            ob_start();
            post_comments_feed_link($comments_rss_matches[2]);
            $comments_rss_link = ob_get_contents();
            ob_end_clean();
            // make link nofollow if set in theme options
            if ($bfa_ata['nofollow'] == "Yes") {
                $comments_rss_link = str_replace('href=', 'rel="nofollow" href=', $comments_rss_link);
            }
            $postinfo = preg_replace("/(.*)%comments-rss\\((.*?)\\)%(.*)/i", "\${1}" . $comments_rss_link . "\${3}", $postinfo);
        }
    }
    // Trackback URL
    if (strpos($postinfo_string, '%trackback%') !== FALSE) {
        $trackback_url = trackback_url(FALSE);
        $postinfo = str_replace("%trackback%", $trackback_url, $postinfo);
    }
    // Trackback Link
    if (strpos($postinfo_string, '%trackback-linked(') !== FALSE) {
        while (strpos($postinfo, '%trackback-linked(') !== FALSE) {
            $trackback_url = trackback_url(FALSE);
            $trackback_link_text = preg_match("/(.*)%trackback-linked\\('(.*?)'(.*)/i", $postinfo_string, $trackback_matches);
            $trackback_link = '<a href="' . $trackback_url . '">' . $trackback_matches[2] . '</a>';
            // make link nofollow if set in theme options
            if ($bfa_ata['nofollow'] == "Yes") {
                $trackback_link = str_replace('href=', 'rel="nofollow" href=', $trackback_link);
            }
            $postinfo = preg_replace("/(.*)%trackback-linked\\((.*?)\\)%(.*)/i", "\${1}" . $trackback_link . "\${3}", $postinfo);
        }
    }
    // Trackback RDF
    if (strpos($postinfo_string, '%trackback-rdf%') !== FALSE) {
        ob_start();
        trackback_rdf();
        $trackback_rdf = "<!-- " . ob_get_contents() . " -->";
        ob_end_clean();
        $postinfo = str_replace("%trackback-rdf%", $trackback_rdf, $postinfo);
    }
    // Permalink
    if (strpos($postinfo_string, '%permalink%') !== FALSE) {
        ob_start();
        the_permalink();
        $permalink = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%permalink%", $permalink, $postinfo);
    }
    // Post ID
    if (strpos($postinfo_string, '%post-id%') !== FALSE) {
        ob_start();
        the_ID();
        $post_id = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-id%", $post_id, $postinfo);
    }
    // Post Title
    if (strpos($postinfo_string, '%post-title%') !== FALSE) {
        ob_start();
        the_title();
        $post_title = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%post-title%", $post_title, $postinfo);
    }
    // Edit post
    if (strpos($postinfo_string, '%edit(') !== FALSE) {
        while (strpos($postinfo, '%edit(') !== FALSE) {
            $edit_options = preg_match("/(.*)%edit\\('(.*?)'(.*?)'(.*?)'(.*?)'(.*?)'(.*)/i", $postinfo_string, $edit_matches);
            ob_start();
            edit_post_link($edit_matches[4], $edit_matches[2], $edit_matches[6]);
            $edit_link = ob_get_contents();
            ob_end_clean();
            $postinfo = preg_replace("/(.*)%edit\\((.*?)\\)%(.*)/i", "\${1}" . $edit_link . "\${3}", $postinfo);
        }
    }
    // Print
    if (strpos($postinfo_string, '%print(') !== FALSE) {
        while (strpos($postinfo, '%print(') !== FALSE) {
            $print_text = preg_match("/(.*)%print\\('(.*?)'(.*)/i", $postinfo_string, $print_text_matches);
            $print_link = '<a href="javascript:window.print()">' . $print_text_matches[2] . '</a>';
            $postinfo = preg_replace("/(.*)%print\\((.*?)\\)%(.*)/i", "\${1}" . $print_link . "\${3}", $postinfo);
        }
    }
    // For the "WP-Email" plugin
    if (strpos($postinfo_string, '%wp-email%') !== FALSE) {
        $wp_email = function_exists('wp_email') ? email_link($email_post_text = '', $email_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-email%", $wp_email, $postinfo);
    }
    // For the "WP-Print" plugin
    if (strpos($postinfo_string, '%wp-print%') !== FALSE) {
        $wp_print = function_exists('wp_print') ? print_link($print_post_text = '', $print_page_text = '', $echo = FALSE) : "";
        $postinfo = str_replace("%wp-print%", $wp_print, $postinfo);
    }
    // For the "WP-PostViews" plugin
    if (strpos($postinfo_string, '%wp-postviews%') !== FALSE) {
        $wp_postviews = function_exists('the_views') ? the_views($display = FALSE) : "";
        $postinfo = str_replace("%wp-postviews%", $wp_postviews, $postinfo);
    }
    // For the "WP-PostRatings" plugin
    if (strpos($postinfo_string, '%wp-postratings%') !== FALSE) {
        $wp_postratings = function_exists('the_ratings') ? the_ratings($start_tag = 'span', $custom_id = 0, $display = FALSE) : "";
        $postinfo = str_replace("%wp-postratings%", $wp_postratings, $postinfo);
    }
    // For the "Sociable" plugin
    if (strpos($postinfo_string, '%sociable%') !== FALSE) {
        ob_start();
        $sociable = (function_exists('sociable_html2') and function_exists(do_sociable())) ? do_sociable() : "";
        $sociable = ob_get_contents();
        ob_end_clean();
        $postinfo = str_replace("%sociable%", $sociable, $postinfo);
    }
    // For the "Share This" plugin
    if (strpos($postinfo_string, '%share-this%') !== FALSE) {
        ob_start();
        if (function_exists('sharethis_button')) {
            sharethis_button();
            $share_this = ob_get_contents();
        } else {
            $share_this = "";
        }
        ob_end_clean();
        $postinfo = str_replace("%share-this%", $share_this, $postinfo);
    }
    // Images
    if (strpos($postinfo_string, '<image(') !== FALSE) {
        $postinfo = preg_replace_callback("|<image\\((.*?)\\)>|", "bfa_image_files", $postinfo);
    }
    /* The meta = ALL custom fields:values, formatted by Wordpress as
    	unordered list <ul><li>..</li><li>..</li></ul> */
    if (strpos($postinfo_string, '%meta%') !== FALSE) {
        ob_start();
        the_meta();
        $the_meta = ob_get_contents();
        ob_end_clean();
        // 3.4.3.: remove bfa_ata metas */
        $the_meta = preg_replace("/<li>(.*)bfa_ata(.*)<\\/li>/i", "", $the_meta);
        $postinfo = str_replace("%meta%", $the_meta, $postinfo);
    }
    // Single post meta values, not formatted
    if (strpos($postinfo_string, '%meta(') !== FALSE) {
        $postinfo = preg_replace_callback("|%meta\\('(.*?)'\\)%|", "bfa_meta_value", $postinfo);
    }
    // Since 3.6.7, parse widget areas
    $postinfo = bfa_parse_widget_areas($postinfo);
    return $postinfo;
}
Ejemplo n.º 9
0
        function insertPages_handleShortcode_insert($atts, $content = null)
        {
            global $wp_query, $post, $wp_current_filter;
            extract(shortcode_atts(array('page' => '0', 'display' => 'all', 'class' => '', 'inline' => false), $atts));
            // Get options set in WordPress dashboard (Settings > Insert Pages).
            $options = get_option('wpip_settings');
            if ($options === FALSE) {
                $options = wpip_set_defaults();
            }
            // Validation checks.
            if ($page === '0') {
                return $content;
            }
            // Trying to embed same page in itself.
            if ($page == $post->ID || $page == $post->post_name) {
                return $content;
            }
            $should_apply_nesting_check = true;
            /**
             * Filter the flag indicating whether to apply deep nesting check
             * that can prevent circular loops. Note that some use cases rely
             * on inserting pages that themselves have inserted pages, so this
             * check should be disabled for those individuals.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $should_apply_nesting_check = apply_filters('insert_pages_apply_nesting_check', $should_apply_nesting_check);
            // Don't allow inserted pages to be added to the_content more than once (prevent infinite loops).
            if ($should_apply_nesting_check) {
                $done = false;
                foreach ($wp_current_filter as $filter) {
                    if ('the_content' == $filter) {
                        if ($done) {
                            return $content;
                        } else {
                            $done = true;
                        }
                    }
                }
            }
            // Convert slugs to page IDs to standardize query_posts() lookup below.
            if (!is_numeric($page)) {
                $page_object = get_page_by_path($page, OBJECT, get_post_types());
                $page = $page_object ? $page_object->ID : $page;
            }
            if (is_numeric($page)) {
                $args = array('p' => intval($page), 'post_type' => get_post_types());
            } else {
                $args = array('name' => esc_attr($page), 'post_type' => get_post_types());
            }
            query_posts($args);
            $should_apply_the_content_filter = true;
            /**
             * Filter the flag indicating whether to apply the_content filter to post
             * contents and excerpts that are being inserted.
             *
             * @param bool $apply_the_content_filter Indicates whether to apply the_content filter.
             */
            $should_apply_the_content_filter = apply_filters('insert_pages_apply_the_content_filter', $should_apply_the_content_filter);
            $should_use_inline_wrapper = $inline !== false && $inline !== 'false' || array_search('inline', $atts) === 0 || array_key_exists('wpip_wrapper', $options) && $options['wpip_wrapper'] === 'inline';
            /**
             * Filter the flag indicating whether to wrap the inserted content in inline tags (span).
             *
             * @param bool $use_inline_wrapper Indicates whether to wrap the content in span tags.
             */
            $should_use_inline_wrapper = apply_filters('insert_pages_use_inline_wrapper', $should_use_inline_wrapper);
            // Disable the_content filter if using inline tags, since wpautop
            // inserts p tags and we can't have any inside inline elements.
            if ($should_use_inline_wrapper) {
                $should_apply_the_content_filter = false;
            }
            // Start our new Loop (only iterate once).
            if (have_posts()) {
                ob_start();
                // Start output buffering so we can save the output to string
                // If Beaver Builder plugin is enabled, load any cached styles associated with the inserted page.
                // Note: Temporarily set the global $post->ID to the inserted page ID,
                // since Beaver Builder relies on it to load the appropraite styles.
                if (class_exists('FLBuilder')) {
                    $old_post_id = $post->ID;
                    $post->ID = $page;
                    FLBuilder::enqueue_layout_styles_scripts($page);
                    $post->ID = $old_post_id;
                }
                // Show either the title, link, content, everything, or everything via a custom template
                // Note: if the sharing_display filter exists, it means Jetpack is installed and Sharing is enabled;
                // This plugin conflicts with Sharing, because Sharing assumes the_content and the_excerpt filters
                // are only getting called once. The fix here is to disable processing of filters on the_content in
                // the inserted page. @see https://codex.wordpress.org/Function_Reference/the_content#Alternative_Usage
                switch ($display) {
                    case "title":
                        the_post();
                        $title_tag = $should_use_inline_wrapper ? 'span' : 'h1';
                        echo "<{$title_tag} class='insert-page-title'>";
                        the_title();
                        echo "</{$title_tag}>";
                        break;
                    case "link":
                        the_post();
                        ?>
<a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_title();
                        ?>
</a><?php 
                        break;
                    case "excerpt":
                        the_post();
                        ?>
<h1><a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h1><?php 
                        if ($should_apply_the_content_filter) {
                            the_excerpt();
                        } else {
                            echo get_the_excerpt();
                        }
                        break;
                    case "excerpt-only":
                        the_post();
                        if ($should_apply_the_content_filter) {
                            the_excerpt();
                        } else {
                            echo get_the_excerpt();
                        }
                        break;
                    case "content":
                        the_post();
                        if ($should_apply_the_content_filter) {
                            the_content();
                        } else {
                            echo get_the_content();
                        }
                        break;
                    case "all":
                        the_post();
                        $title_tag = $should_use_inline_wrapper ? 'span' : 'h1';
                        echo "<{$title_tag} class='insert-page-title'>";
                        the_title();
                        echo "</{$title_tag}>";
                        if ($should_apply_the_content_filter) {
                            the_content();
                        } else {
                            echo get_the_content();
                        }
                        the_meta();
                        break;
                    default:
                        // display is either invalid, or contains a template file to use
                        $template = locate_template($display);
                        if (strlen($template) > 0) {
                            include $template;
                            // execute the template code
                        } else {
                            // Couldn't find template, so fall back to printing a link to the page.
                            the_post();
                            ?>
<a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a><?php 
                        }
                        break;
                }
                $content = ob_get_contents();
                // Save off output buffer
                ob_end_clean();
                // End output buffering
            } else {
                /**
                 * Filter the html that should be displayed if an inserted page was not found.
                 *
                 * @param string $content html to be displayed. Defaults to an empty string.
                 */
                $content = apply_filters('insert_pages_not_found_message', $content);
            }
            wp_reset_query();
            $wrapper_tag = $should_use_inline_wrapper ? 'span' : 'div';
            $content = "<{$wrapper_tag} data-post-id='{$page}' class='insert-page insert-page-{$page} {$class}'>{$content}</{$wrapper_tag}>";
            return $content;
            //return do_shortcode($content); // careful: watch for infinite loops with nested inserts
        }
Ejemplo n.º 10
0
    ?>
                <div class="page-header">
                    <h1>currently no posts are availabe</h1>
                </div>
            <?php 
}
?>
        </div>
        <?php 
get_sidebar();
?>

    </div>
</div>
<?php 
echo the_meta();
echo wp_get_attachment_image(143);
global $post;
$thePostID = $post->ID;
echo $thePostID;
echo $post->post_title;
echo "khan";
$custom_field_value = get_post_custom_values('image1');
print_r($custom_field_value);
echo wp_get_attachment_image(implode($custom_field_value));
global $wpdb;
$get = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE ID=%h");
var_dump($get);
$url = wp_upload_dir();
var_dump($url);
get_footer();
Ejemplo n.º 11
0
    function process_shortcodes($atts)
    {
        if (isset($atts['options']) && $atts['options']) {
            $options = explode(',', $atts['options']);
            unset($atts['options']);
        } else {
            $options = array('title', 'thumbnail', 'excerpt', 'readmore');
        }
        query_posts($atts);
        while (have_posts()) {
            the_post();
            ?>
			<div>
				<?php 
            foreach ($options as $option) {
                switch ($option) {
                    case 'id':
                        ?>
<div class="id"><?php 
                        the_ID();
                        ?>
</div><?php 
                        break;
                    case 'title':
                        ?>
<div class="title"><?php 
                        the_title();
                        ?>
</div><?php 
                        break;
                    case 'thumbnail':
                        ?>
<div class="thumbnail"><?php 
                        the_thumbnail();
                        ?>
</div><?php 
                        break;
                    case 'excerpt':
                        ?>
<div class="excerpt"><?php 
                        the_excerpt();
                        ?>
</div><?php 
                        break;
                    case 'content':
                        ?>
<div class="content"><?php 
                        the_content();
                        ?>
</div><?php 
                        break;
                    case 'meta':
                        ?>
<div class="meta"><?php 
                        the_meta();
                        ?>
</div><?php 
                        break;
                    case 'author':
                        ?>
<div class="author"><?php 
                        the_author();
                        ?>
</div><?php 
                        break;
                    case 'readmore':
                        ?>
<div class="readmore"><a href="<?php 
                        the_permalink();
                        ?>
">read more</a></div><?php 
                        break;
                    case 'category':
                        ?>
<div class="category"><?php 
                        the_category();
                        ?>
</div><?php 
                        break;
                    case 'tags':
                        ?>
<div class="tags"><?php 
                        the_tags();
                        ?>
</div><?php 
                        break;
                    case 'terms':
                        ?>
<div class="tags"><?php 
                        the_terms();
                        ?>
</div><?php 
                        break;
                }
            }
            ?>
			</div>
		<?php 
        }
        wp_reset_query();
    }
 /**
  * Displays meta information for posts as a dump
  * @param object $content The content of the current post
  * @var $wp_query Global WordPress query variable
  * @return string The post content with the meta information prepended as a dump
  */
 function formatting($content)
 {
     global $wp_query;
     return $content . the_meta();
 }
Ejemplo n.º 13
0
    </div>
    
    <div class="clearfix"></div>
    
    <div class="g10">
    <?php
	if ( has_post_thumbnail() ) {
		// the current post has a thumbnail
	} else {
		// the current post lacks a thumbnail
	}
	?>
    <?php the_post_thumbnail(); ?>
    </div>
     
    <div class="g2 pre2"><?php the_meta(); ?></div>
    <div class="g2 pre2"><a class="blackbox" href="/"><p class="blackbox">Home sweet home</p></a></div>
  </div><!--/post-->
  </li>

  <?php endwhile; ?>
  <?php endif; ?>
</ul>

<canvas id="canvas" width="1000" height="515"></canvas>
</div>

</body>

</html>
Ejemplo n.º 14
0
function cust_field_text($column_name)
{
    if ($column_name === 'cust_col') {
        the_meta();
    }
}