本文整理汇总了PHP中get_page_by_title函数的典型用法代码示例。如果您正苦于以下问题:PHP get_page_by_title函数的具体用法?PHP get_page_by_title怎么用?PHP get_page_by_title使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_page_by_title函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: charity_vc_our_mission
function charity_vc_our_mission($atts, $content = null)
{
extract(shortcode_atts(array('our_mission' => ''), $atts));
$page_id = get_page_by_title($our_mission);
$missionQuery = new WP_Query(array("page_id" => $page_id->ID));
if ($missionQuery->have_posts()) {
$missionQuery->the_post();
$url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
?>
<!-- Save Lives Section Start Here-->
<section class="save-lives text-center parallax" style="background-image: url('<?php
echo esc_url($url[0]);
?>
')">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<header class="page-header">
<h2><?php
the_title();
?>
</h2>
<?php
the_content();
?>
</header>
</div>
</div>
</div>
</section>
<!-- Save Lives Section Start Here-->
<?php
}
wp_reset_postdata();
}
开发者ID:kautzar,项目名称:drpp4,代码行数:35,代码来源:our-mission.php
示例2: widget
public function widget($args, $instance)
{
$title = apply_filters('widget_title', $instance['title']);
$text = apply_filters('widget_text', empty($instance['text']) ? '' : $instance['text'], $instance);
echo $args['before_widget'];
$contact_page = get_page_by_title('Contact');
?>
<article class="contact-widget dashed-widget">
<h2><?php
echo $title;
?>
</h2>
<p>
<?php
echo $text;
?>
</p>
<a class="button secondary-button" href="<?php
echo get_permalink($contact_page->ID);
?>
" title="Neem contact op"><i class="fa fa-angle-right"></i> Neem contact op</a>
</article>
<?php
echo $args['after_widget'];
}
开发者ID:arjenkroeze,项目名称:tante-kiki,代码行数:27,代码来源:contact-widget.php
示例3: oxy_filter_import_menu_item
function oxy_filter_import_menu_item($new_menu_item, $menu_item, $one_click)
{
switch ($menu_item['type']) {
case 'post_type':
case 'taxonomy':
switch ($menu_item['object']) {
case 'oxy_mega_menu':
$mega_menu = get_page_by_title('Mega Menu', 'OBJECT', 'oxy_mega_menu');
$new_menu_item['menu-item-object-id'] = $mega_menu->ID;
break;
case 'oxy_mega_columns':
$columns = get_posts(array('post_type' => 'oxy_mega_columns'));
foreach ($columns as $column) {
if ($column->post_content === $menu_item['post_content']) {
$new_menu_item['menu-item-object-id'] = $column->ID;
}
}
break;
default:
$new_id = $one_click->lookup_map($menu_item['object'], $menu_item['object_id']);
if ($new_id !== false) {
$new_menu_item['menu-item-object-id'] = $new_id;
}
break;
}
break;
case 'custom':
default:
// do nothing
break;
}
return $new_menu_item;
}
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:33,代码来源:one-click-import.php
示例4: sfhiv_preview_shortcode
function sfhiv_preview_shortcode($atts, $content = null)
{
global $post;
extract(shortcode_atts(array('id' => false, 'title' => false, 'replace_title' => false, 'replace_content' => false, 'template' => 'preview'), $atts));
$preview_post = false;
$return_content = "";
if (isset($title)) {
$preview_post = get_page_by_title($title);
}
if (isset($id) && !$preview_post) {
$num = (int) $id;
$preview_post = get_post($num);
}
if ($preview_post) {
$org_post = $post;
$post = $preview_post;
if ($replace_title) {
$post->post_title = $replace_title;
}
if ($content != null) {
$post->post_content = $content;
$post->post_excerpt = $content;
}
if ($replace_content) {
$post->post_content = $replace_content;
$post->post_excerpt = $replace_content;
}
ob_start();
get_template_part($template, $post->post_type);
$return_content = ob_get_clean();
$post = $org_post;
}
return $return_content;
}
开发者ID:nickdotreid,项目名称:SFHIV-Wordpress-Theme,代码行数:34,代码来源:preview-shortcode.php
示例5: setUpRestIOA
function setUpRestIOA()
{
/**
* Setup Header Data
*/
$header_data = "W1t7Im5hbWUiOiJUYWdsaW5lPGEgaHJlZj1cXFwiXFxcIiBjbGFzcz1cXFwiaGNvbi1lZGl0IGVudHlwbyBwZW5jaWxcXFwiPjxcL2E+IiwidmFsdWUiOiJ0YWdsaW5lIiwiYWxpZ24iOiJkZWZhdWx0IiwibWFyZ2luIjoiMDowOjA6MCJ9XSxbeyJjb250YWluZXIiOiJ0b3AtYXJlYSIsImV5ZSI6Im9uIiwicG9zaXRpb24iOiJzdGF0aWMiLCJoZWlnaHQiOiIwIiwiZGF0YSI6W3siYWxpZ24iOiJsZWZ0IiwiZWxlbWVudHMiOlt7InZhbCI6IndwbWwiLCJhbGlnbiI6ImRlZmF1bHQiLCJ0ZXh0IjoiIiwibWFyZ2luIjoiMDowOjA6MCIsIm5hbWUiOiJXUE1MIFNlbGVjdG9yIn0seyJ2YWwiOiJzb2NpYWwiLCJhbGlnbiI6ImRlZmF1bHQiLCJ0ZXh0IjoidHdpdHRlcjx2Yz5odHRwczpcL1wvdHdpdHRlci5jb21cL2FydGlsbGVnZW5jZTxzYz5mYWNlYm9vazx2Yz5odHRwczpcL1wvd3d3LmZhY2Vib29rLmNvbVwvYXJ0aWxsZWdlbmNlPHNjPmZsaWNrcjx2Yz5odHRwOlwvXC9mbGlja3IuY29tXC88c2M+dmltZW88dmM+aHR0cHM6XC9cL3ZpbWVvLmNvbVwvdXNlcjIwMDIyMDg5PHNjPnBpbnRlcmVzdDx2Yz5odHRwczpcL1wvcGludGVyZXN0LmNvbVwvPHNjPmRyaWJiYmxlPHZjPmh0dHA6XC9cL2RyaWJiYmxlLmNvbVwvYXJ0aWxsZWdlbmNlPHNjPnNreXBlPHZjPmNhbGw6YWJoaW4uc2hhcm1hPHNjPiIsIm1hcmdpbiI6IjA6MDowOjAiLCJuYW1lIjoiU29jaWFsIEljb25zIn0seyJ2YWwiOiJ0ZXh0IiwiYWxpZ24iOiJkZWZhdWx0IiwidGV4dCI6IkhlbHBsaW5lICsxIDM0MzMzMzMzMyIsIm1hcmdpbiI6IjEwOjA6MDoxNyIsIm5hbWUiOiJUZXh0ICJ9XX0seyJhbGlnbiI6ImNlbnRlciJ9LHsiYWxpZ24iOiJyaWdodCIsImVsZW1lbnRzIjpbeyJ2YWwiOiJ0b3AtbWVudSIsImFsaWduIjoiZGVmYXVsdCIsInRleHQiOiIwIiwibWFyZ2luIjoiMDowOjA6MCIsIm5hbWUiOiJNZW51IDIifV19XX0seyJjb250YWluZXIiOiJtZW51LWFyZWEiLCJleWUiOiJvbiIsInBvc2l0aW9uIjoic3RhdGljIiwiaGVpZ2h0IjoiMCIsImRhdGEiOlt7ImFsaWduIjoibGVmdCIsImVsZW1lbnRzIjpbeyJ2YWwiOiJsb2dvIiwiYWxpZ24iOiJkZWZhdWx0IiwidGV4dCI6IjAiLCJtYXJnaW4iOiIwOjA6MDowIiwibmFtZSI6IkxvZ28ifV19LHsiYWxpZ24iOiJjZW50ZXIifSx7ImFsaWduIjoicmlnaHQiLCJlbGVtZW50cyI6W3sidmFsIjoic2VhcmNoIiwiYWxpZ24iOiJkZWZhdWx0IiwidGV4dCI6IjAiLCJtYXJnaW4iOiI2OjA6MDowIiwibmFtZSI6IlNlYXJjaCBCYXIifSx7InZhbCI6Im1haW4tbWVudSIsImFsaWduIjoiZGVmYXVsdCIsInRleHQiOiIwIiwibWFyZ2luIjoiMDowOjA6MCIsIm5hbWUiOiJNZW51IDEifV19XX0seyJjb250YWluZXIiOiJ0b3AtZnVsbC1hcmVhIiwiZXllIjoib2ZmIiwicG9zaXRpb24iOiJzdGF0aWMiLCJoZWlnaHQiOiIiLCJkYXRhIjpbeyJhbGlnbiI6ImxlZnQifSx7ImFsaWduIjoiY2VudGVyIn0seyJhbGlnbiI6InJpZ2h0In1dfV1d";
$header_data = base64_decode($header_data);
$header_data = json_decode($header_data, true);
update_option(SN . '_header_construction_data', $header_data);
update_option(SN . 'font_selector', 'google');
update_option(SN . 'font_stacks', array('Raleway;;'));
$images = get_option('ioa_demo_images');
setMenus();
setMetaData();
setWidgets();
setShopData();
$page = get_page_by_title('Home');
update_option('page_on_front', $page->ID);
update_option('show_on_front', 'page');
if (function_exists('rev_slider_shortcode')) {
require_once HPATH . "/installer/rev_import_class.php";
$c = new CustomREVInstaller();
$c->importREVSliderFromPost(HPATH . '/installer/slider_export.txt');
$c->importREVSliderFromPost(HPATH . '/installer/slider_export_1.txt');
$c->importREVSliderFromPost(HPATH . '/installer/slider_export_2.txt');
}
}
开发者ID:severnrescue,项目名称:web,代码行数:27,代码来源:installer.php
示例6: charity_vc_our_story
function charity_vc_our_story($atts, $content = null)
{
extract(shortcode_atts(array('our_story' => ''), $atts));
$page_id = get_page_by_title($our_story);
$storyQuery = new WP_Query(array("page_id" => $page_id->ID));
if ($storyQuery->have_posts()) {
$storyQuery->the_post();
$url = wp_get_attachment_image_src(get_post_thumbnail_id($page_id->ID), array(1143, 479));
?>
<!-- Helping Section Start here-->
<section class="helping-child parallax" style="background-image: url('<?php
echo esc_url($url[0]);
?>
')">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-7 col-md-5">
<h2 class="h1"> <?php
the_title();
?>
</h2>
<?php
the_content();
?>
</div>
</div>
</div>
</section>
<!-- Helping Section Start here-->
<?php
}
wp_reset_postdata();
}
开发者ID:Angelpm28,项目名称:ong-canada,代码行数:34,代码来源:our-story.php
示例7: piskotki_create_page
function piskotki_create_page()
{
global $wpdb;
$page_title = 'Piškotki';
$page_name = 'piskotki';
delete_option('piskotki_page_title');
add_option('piskotki_page_title', $page_title, '', 'yes');
delete_option('piskotki_page_name');
add_option('piskotki_page_name', $page_name, '', 'yes');
delete_option('piskotki_page_id');
add_option('piskotki_page_id', '0', '', 'yes');
$page = get_page_by_title($page_title);
if (!$page) {
$_p = array();
$_p['post_title'] = $page_title;
$_p['post_content'] = "To besedilo se lahko prepiše preko vtičnika. Ne urejajte ga tukaj!";
$_p['post_status'] = 'publish';
$_p['post_type'] = 'page';
$_p['comment_status'] = 'closed';
$_p['ping_status'] = 'closed';
$page_id = wp_insert_post($_p);
} else {
$page_id = $page->ID;
$page->post_status = 'publish';
$page_id = wp_update_post($page);
delete_option('piskotki_page_id');
add_option('piskotki_page_id', $page_id);
}
}
开发者ID:jelenaljaz,项目名称:piskotki,代码行数:29,代码来源:piskotki.php
示例8: activate
/**
* Short Description. (use period)
*
* Long Description.
*
* @since 1.0.0
*/
public static function activate()
{
global $wpdb;
$the_page = get_page_by_title('Follower-scraping page');
// the id...
if (!$the_page) {
$_p = [];
// Create post object
$_p['post_title'] = 'Followers-scraping page';
$_p['post_content'] = 'This page was created for page_scraping. <b>Do not delete it!</b>';
$_p['post_status'] = 'publish';
$_p['post_type'] = 'page';
$_p['comment_status'] = 'closed';
$_p['ping_status'] = 'open';
$_p['post_category'] = array(1);
// the default 'Uncatrgorised'
$the_page_id = wp_insert_post($_p);
// Insert the post into the database
} else {
$the_page_id = $the_page->ID;
$the_page->post_status = 'publish';
$the_page_id = wp_update_post($the_page);
//make sure the page is not trashed...
}
delete_option('followers_scrape_id');
add_option('followers_scrape_id', $the_page_id);
//update_option( 'show_on_front', 'page' );
//update_option( 'page_on_front', $the_page_id );
}
开发者ID:fs-alex,项目名称:followers-scraper,代码行数:36,代码来源:class-followers-scraper-activator.php
示例9: ctcc_create_policy_page
function ctcc_create_policy_page()
{
//Check to see if the info page has been created
$more_info_page = get_option('ctcc_more_info_page');
if (empty($more_info_page)) {
// The page hasn't been set yet
// Create the page parameters
$pagename = __('Cookie Policy', 'uk-cookie-consent');
$content = __('This site uses cookies - small text files that are placed on your machine to help the site provide a better user experience. In general, cookies are used to retain user preferences, store information for things like shopping carts, and provide anonymised tracking data to third party applications like Google Analytics. As a rule, cookies will make your browsing experience better. However, you may prefer to disable cookies on this site and on others. The most effective way to do this is to disable cookies in your browser. We suggest consulting the Help section of your browser or taking a look at <a href="http://www.aboutcookies.org">the About Cookies website</a> which offers guidance for all modern browsers', 'uk-cookie-consent');
$cpage = get_page_by_title($pagename);
// Double check there's not already a Cookie Policy page
if (!$cpage) {
global $user_ID;
$page['post_type'] = 'page';
$page['post_content'] = $content;
$page['post_parent'] = 0;
$page['post_author'] = $user_ID;
$page['post_status'] = 'publish';
$page['post_title'] = $pagename;
$pageid = wp_insert_post($page);
} else {
// There's already a page called Cookie Policy so we'll use that
$pageid = $cpage->ID;
}
// Update the option
update_option('ctcc_more_info_page', $pageid);
}
}
开发者ID:AndyA,项目名称:River,代码行数:28,代码来源:uk-cookie-consent.php
示例10: get_my_page_by_title
function get_my_page_by_title($title)
{
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
$page = get_page_by_title($title);
return $page;
}
开发者ID:gmateu,项目名称:liceuWP,代码行数:7,代码来源:index.php
示例11: import_posts_pages
function import_posts_pages($xml_file, $option_file, $stepNumber = 1, $numberOfSteps = 1)
{
//do the actual import
$this->import_stepped($xml_file, $stepNumber, $numberOfSteps);
//only set the pages after the last step
if ($stepNumber == $numberOfSteps) {
if (file_exists($option_file)) {
@(include_once $option_file);
}
//set the front and blog page
// Use a static front page
if (isset($demo_reading_pages['front']) && !empty($demo_reading_pages['front'])) {
update_option('show_on_front', 'page');
$home_page = get_page_by_title($demo_reading_pages['front']);
if (isset($home_page->ID)) {
update_option('page_on_front', $home_page->ID);
}
}
// Set the blog page
if (isset($demo_reading_pages['blog']) && !empty($demo_reading_pages['blog'])) {
$blog_page = get_page_by_title($demo_reading_pages['blog']);
if (isset($blog_page->ID)) {
update_option('page_for_posts', $blog_page->ID);
}
}
update_option('listable_demo_data_imported', true);
do_action('import_demo_data_end');
}
//Ensure the $wp_rewrite global is loaded
global $wp_rewrite;
//Call flush_rules() as a method of the $wp_rewrite object
$wp_rewrite->flush_rules();
return true;
}
开发者ID:ksingh812,项目名称:epb,代码行数:34,代码来源:wpgrade-import-class.php
示例12: create_page_if_not_exist
/**
* Create a page if it not exist in the stack
* @param {string} page_name - name of the page that will be evaluated
*/
private function create_page_if_not_exist($page_name)
{
if (get_page_by_title($page_name) == NULL) {
$this->create_page($page_name);
}
$this->assign_frontpage($page_name);
}
开发者ID:vampaynani,项目名称:moxie_test,代码行数:11,代码来源:pagemanager.class.php
示例13: sitemap_area
function sitemap_area($post, $title = '')
{
$map = get_page_by_title('Site Map');
?>
<tr>
<td valign="top">
<div class="header">
<?php
if ($title) {
echo $title;
} else {
the_title();
}
?>
</div>
<div class="nav">
<a href="<?php
echo get_permalink($map->ID);
?>
" class="navigation">sitemap</a>
<?php
echo get_breadcrumbs($post);
?>
</div>
<?php
}
开发者ID:rick,项目名称:wa-k.o,代码行数:26,代码来源:functions.php
示例14: start_el
function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
{
$item_html = '';
parent::start_el($item_html, $object, $depth, $args);
$output .= $depth == 0 ? '' : '';
$classes = empty($object->classes) ? array() : (array) $object->classes;
// Fix dropdown menús con children - chevron
$dropdownSections = ["nosotros", "about us"];
foreach ($dropdownSections as $section) {
if (in_array(str_replace(' ', '-', $section), $classes)) {
$output .= '';
$url = get_permalink(get_page_by_title($section)->ID);
$replacement = "<i class=\"fa fa-chevron-down\"></i><a href=\"" . esc_url($url) . "\">" . ucfirst($section) . "</a>";
$item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', $replacement, $item_html);
}
}
//
if (in_array('label', $classes)) {
$output .= '';
$item_html = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '<label>$1</label>', $item_html);
}
if (in_array('divider', $classes)) {
$item_html = preg_replace('/<a[^>]*>( .* )<\\/a>/iU', '', $item_html);
}
$output .= $item_html;
}
开发者ID:Calraiser,项目名称:flux,代码行数:26,代码来源:menu-walker.php
示例15: add_new_page
function add_new_page()
{
global $wpdb;
$the_page_title = $_REQUEST['trial_page_title'];
$the_page_desc = $_REQUEST['trial_page_desc'];
$the_page_url = $_REQUEST['trial_page_url'];
$the_page_name = 'trial_page';
$the_page = get_page_by_title($the_page_title);
if (!$the_page) {
// Create post object
$_p = array();
$_p['post_title'] = $the_page_title;
$_p['post_content'] = $the_page_desc;
$_p['post_status'] = 'publish';
$_p['post_type'] = 'page';
$_p['post_name'] = $the_page_url;
$_p['comment_status'] = 'closed';
$_p['ping_status'] = 'closed';
$_p['post_category'] = array(1);
// the default 'Uncatrgorised'
// Insert the post into the database
$the_page_id = wp_insert_post($_p);
} else {
// the plugin may have been previously active and the page may just be trashed...
$the_page_id = $the_page->ID;
//make sure the page is not trashed...
$the_page->post_status = 'publish';
$the_page_id = wp_update_post($the_page);
}
}
开发者ID:bear1030,项目名称:new_page_plugin,代码行数:30,代码来源:add_new_page.php
示例16: save_post_hook
function save_post_hook($post_id)
{
if (get_post_type($post_id) == 'medic') {
// delete_post_meta($post_id,'altele_foto');
$the_terms = get_the_terms($post_id, 'specialitate');
if (is_array($the_terms) && sizeof($the_terms > 0)) {
foreach ($the_terms as $term) {
//print_r($term->name);
$page = get_page_by_title($term->name, 'OBJECT', 'specialitati');
if (!$page) {
$new_post = array('post_type' => 'specialitati', 'post_name' => $term->name, 'post_title' => $term->name, 'post_content' => 'Pagina generata dinamic.', 'post_status' => 'publish');
//var_dump($new_post);
$wp_error = new \wp_error();
$post_id = wp_insert_post($new_post, $wp_error);
$done = wp_set_object_terms($post_id, $term->name, 'specialitate', true);
}
$page = get_page_by_title($term->name, 'OBJECT', 'cabinet');
// var_dump($page);die();
if (!$page) {
$new_post = array('post_type' => 'cabinet', 'post_name' => $term->name, 'post_title' => $term->name, 'post_content' => 'Pagina generata dinamic.', 'post_status' => 'publish');
//var_dump($new_post);die();
$wp_error = new \wp_error();
$post_id = wp_insert_post($new_post, $wp_error);
$done = wp_set_object_terms($post_id, $term->name, 'cabinet', true);
}
}
}
//die();
}
}
开发者ID:madonion,项目名称:p0limed,代码行数:30,代码来源:custom_code.php
示例17: import_testimonials_from_csv
private function import_testimonials_from_csv($testimonials_file)
{
//increase execution time before beginning import, as this could take a while
set_time_limit(0);
//use current timestamp for batch number
$batch_number = time();
$testimonials = $this->csv_to_array($testimonials_file);
foreach ($testimonials as $testimonial) {
//defaults
$the_name = $the_body = '';
if (isset($testimonial['Title'])) {
$the_name = $testimonial['Title'];
}
if (isset($testimonial['Body'])) {
$the_body = $testimonial['Body'];
}
//look for a testimonial with the title and body
//if not found, insert this one
$postslist = get_page_by_title($the_name, OBJECT, 'testimonial');
//if this is empty, a match wasn't found and therefore we are safe to insert
if (empty($postslist)) {
//insert the testimonials
$tags = array();
$post = array('post_title' => $the_name, 'post_content' => $the_body, 'post_category' => array(1), 'tags_input' => $tags, 'post_status' => 'publish', 'post_type' => 'testimonial', 'post_author' => get_option('easy_t_testimonial_author', 1));
$new_id = wp_insert_post($post);
// assign Staff Member Categories if any were specified
// NOTE: we are using wp_set_object_terms instead of adding a tax_input key to wp_insert_posts, because
// it is less likely to fail b/c of permissions and load order (i.e., taxonomy may not have been created yet)
if (!empty($testimonial['Categories'])) {
$post_cats = explode(',', $testimonial['Categories']);
$post_cats = array_map('intval', $post_cats);
// sanitize to ints
wp_set_object_terms($new_id, $post_cats, 'easy-testimonial-category');
}
//defaults, in case certain data wasn't in the CSV
$client_name = isset($testimonial['Client Name']) ? $testimonial['Client Name'] : "";
$email = isset($testimonial['E-Mail Address']) ? $testimonial['E-Mail Address'] : "";
$position_location_other = isset($testimonial['Position / Location / Other']) ? $testimonial['Position / Location / Other'] : "";
$location_product_other = isset($testimonial['Location / Product / Other']) ? $testimonial['Location / Product / Other'] : "";
$rating = isset($testimonial['Rating']) ? $testimonial['Rating'] : "";
$htid = isset($testimonial['HTID']) ? $testimonial['HTID'] : "";
$featured_image = isset($testimonial['Featured Image']) ? $testimonial['Featured Image'] : "";
update_post_meta($new_id, '_ikcf_client', $client_name);
update_post_meta($new_id, '_ikcf_email', $email);
update_post_meta($new_id, '_ikcf_position', $position_location_other);
update_post_meta($new_id, '_ikcf_other', $location_product_other);
update_post_meta($new_id, '_ikcf_rating', $rating);
update_post_meta($new_id, '_ikcf_htid', $htid);
update_post_meta($new_id, '_ikcf_import_batch', $batch_number);
// Look for a photo path on CSV
// If found, try to import this photo and attach it to this staff member
$this->import_testimonial_photo($new_id, $featured_image);
$inserted = true;
echo "Successfully imported '{$the_name}'!\n";
} else {
//rejected as duplicate
echo "Could not import {$the_name}; rejected as Duplicate\n";
}
}
}
开发者ID:benshez,项目名称:DreamWeddingCeremonies,代码行数:60,代码来源:gp-testimonial-importer.class.php
示例18: url_shortcode
function url_shortcode($atts)
{
// Attributes
extract(shortcode_atts(array('type' => '', 'id' => '0', 'path' => '', 'title' => '', 'action' => '', 'class' => ''), $atts));
if (!$id && !$path && !$title && !$action) {
return home_url();
} else {
$page_id = 0;
if ($id && is_numeric($id)) {
$page_id = $id;
}
if ($path != '') {
$page_id = get_page_by_path($path);
}
if ($title != '') {
$page_id = get_page_by_title($title);
}
if ($action != '') {
if ($action == 'logout') {
return wp_logout_url();
}
}
if ($page_id) {
return get_page_link($page_id);
} else {
return null;
}
}
}
开发者ID:sgssandhu,项目名称:aione-tools,代码行数:29,代码来源:general.php
示例19: badgeos_achievement_submissions
/**
* Displays the submission form on achievement type single pages if the meta option is enabled
*
* @since 1.0.0
* @param string $content The page content before meta box insertion
* @return string The page content after meta box insertion
*/
function badgeos_achievement_submissions($content = '')
{
global $post;
if (is_single()) {
// get achievement object for the current post type
$post_type = get_post_type($post);
$achievement = get_page_by_title($post_type, 'OBJECT', 'achievement-type');
if (!$achievement) {
global $wp_post_types;
$labels = array('name', 'singular_name');
// check for other variations
foreach ($labels as $label) {
$achievement = get_page_by_title($wp_post_types[$post_type]->labels->{$label}, 'OBJECT', 'achievement-type');
if ($achievement) {
break;
}
}
}
if (!$achievement) {
return $content;
}
// check if submission or nomination is set
$earned_by = get_post_meta($post->ID, '_badgeos_earned_by', true);
if (($earned_by == 'submission' || $earned_by == 'submission_auto') && is_user_logged_in()) {
$submission = badgeos_submission_form();
//return the content with the submission shortcode data
return $content . $submission;
} elseif ($earned_by == 'nomination' && is_user_logged_in()) {
$nomination = badgeos_nomination_form();
//return the content with the nomination shortcode data
return $content . $nomination;
}
}
return $content;
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:42,代码来源:content-filters.php
示例20: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$unique_page_content = get_page_by_title($instance['unique_page_id']);
global $wp_query;
$current_page = $wp_query->post->ID;
if ($current_page == $unique_page_content->ID || empty($instance['unique_page_id'])) {
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
$eventdays = empty($instance['eventdays']) ? '5' : apply_filters('widget_eventdays', $instance['eventdays']);
$eventcount = empty($instance['eventcount']) ? '' : apply_filters('widget_eventcount', $instance['eventcount']);
$googleaccount = empty($instance['googleaccount']) ? $googleaccount_original : apply_filters('widget_googleaccount', $instance['googleaccount']);
$default_url = "http://www.google.com/calendar/embed?src=" . urlencode($googleaccount) . "&ctz=America/New_York";
$url = empty($instance['url']) ? $default_url : apply_filters('widget_url', $instance['url']);
if (!empty($title)) {
echo $before_title . '<a href="' . htmlspecialchars($url) . '">' . $title . '</a>' . $after_title;
}
if (strlen($googleaccount) > 5) {
echo "<div id='events'>";
include 'widget-simple-google-events-3.php';
echo "</div>";
} else {
echo "<p>Please enter a proper Google Calendar ID in your widget</p>";
}
echo $after_widget;
}
}
开发者ID:sezj,项目名称:ufl-template-responsive,代码行数:27,代码来源:widget-google-calendar.php
注:本文中的get_page_by_title函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论