本文整理汇总了PHP中_get_page_link函数的典型用法代码示例。如果您正苦于以下问题:PHP _get_page_link函数的具体用法?PHP _get_page_link怎么用?PHP _get_page_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_get_page_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_full_permalink
/**
* Retrieve full calendar permalink even if Calendar page is set to be
* homepage.
*
* @param int|object $post Optional. Post ID or object.
* @param bool $leavename Optional. Leave name.
* @param bool $sample Optional. Sample permalink.
*
* @return string
*/
public function get_full_permalink($post = false, $leavename = false, $sample = false)
{
if (false === $post) {
return '';
}
return _get_page_link($post, $leavename, $sample);
}
示例2: getUrl
public function getUrl()
{
global $wp_rewrite;
$obj = $this->getPage();
if ($wp_rewrite->using_permalinks()) {
$link = _get_page_link($obj->ID, false, false);
$link = apply_filters('page_link', $link, $obj->ID, false);
return rtrim($link, "/");
} else {
$link = 'index.php?page_id=' . $obj->ID . '&job_resumes=';
return rtrim(get_home_url(), "/") . "/" . $link;
}
}
示例3: wpbdp_get_page_link
function wpbdp_get_page_link($name = 'main', $arg0 = null)
{
$page_id = wpbdp_get_page_id($name);
if ($page_id) {
$link = _get_page_link($page_id);
} else {
switch ($name) {
case 'view':
case 'viewlisting':
case 'show-listing':
case 'showlisting':
$link = get_permalink(intval($arg0));
break;
case 'edit':
case 'editlisting':
case 'edit-listing':
case 'delete':
case 'deletelisting':
case 'delete-listing':
case 'upgrade':
case 'upgradetostickylisting':
case 'upgradelisting':
case 'upgrade-listing':
$link = add_query_arg(array('action' => $name, 'listing_id' => intval($arg0)), wpbdp_get_page_link('main'));
break;
case 'viewlistings':
case 'view-listings':
$link = add_query_arg(array('action' => 'viewlistings'), wpbdp_get_page_link('main'));
break;
case 'add':
case 'addlisting':
case 'add-listing':
case 'submit':
case 'submitlisting':
case 'submit-listing':
$link = add_query_arg(array('action' => 'submitlisting'), wpbdp_get_page_link('main'));
break;
case 'search':
$link = add_query_arg(array('action' => 'search'), wpbdp_get_page_link('main'));
break;
default:
if (!wpbdp_get_page_id('main')) {
return '';
}
$link = wpbdp_get_page_link('main');
break;
}
}
return apply_filters('wpbdp_get_page_link', $link, $name, $arg0);
}
示例4: page_link
function page_link($link, $id)
{
if ($this->options['redirect_lang'] && $this->page_on_front && ($lang = $this->get_post_language($id))) {
if (!isset($this->posts[$lang->slug][$this->page_on_front])) {
$this->posts[$lang->slug][$this->page_on_front] = $this->get_post($this->page_on_front, $lang);
}
if ($id == $this->posts[$lang->slug][$this->page_on_front]) {
return $this->options['hide_default'] && $lang->slug == $this->options['default_lang'] ? trailingslashit($this->home) : get_term_link($lang, 'language');
}
}
if ($this->page_on_front && $this->options['hide_default']) {
if (!isset($this->posts[$this->options['default_lang']][$this->page_on_front])) {
$this->posts[$this->options['default_lang']][$this->page_on_front] = $this->get_post($this->page_on_front, $this->options['default_lang']);
}
if ($id == $this->posts[$this->options['default_lang']][$this->page_on_front]) {
return trailingslashit($this->home);
}
}
return _get_page_link($id);
}
示例5: printf
</fieldset></td>
</tr><?php
}
if ($page_on_front) {
?>
<tr>
<td><fieldset>
<label><?php
printf('<input name="redirect_lang" type="checkbox" value="1" %s/> %s', $this->options['redirect_lang'] ? 'checked="checked"' : '', __('The front page url contains the language code instead of the page name or page id', 'polylang'));
?>
</label>
<p class="description"><?php
// that's nice to display the right home urls but don't forget that the page on front may have no language yet
$lang = $this->model->get_post_language($page_on_front);
$lang = $lang ? $lang : $this->model->get_language($this->options['default_lang']);
printf(__('Example: %s instead of %s', 'polylang'), '<code>' . esc_html($this->links_model->home_url($lang)) . '</code>', '<code>' . esc_html(_get_page_link($page_on_front)) . '</code>');
?>
</p>
</fieldset></td>
</tr><?php
}
?>
<tr id="pll-detect-browser" <?php
echo 3 > $this->options['force_lang'] ? '' : 'style="display: none;"';
?>
>
<th><?php
_e('Detect browser language', 'polylang');
?>
</th>
示例6: wpsc_refresh_page_urls
/**
* wpsc_refresh_page_urls( $content )
*
* Refresh page urls when permalinks are turned on or altered
*
* @global object $wpdb
* @param string $content
* @return string
*/
function wpsc_refresh_page_urls($content)
{
global $wpdb;
$wpsc_pageurl_option['product_list_url'] = '[productspage]';
$wpsc_pageurl_option['shopping_cart_url'] = '[shoppingcart]';
$check_chekout = $wpdb->get_var("SELECT `guid` FROM `{$wpdb->posts}` WHERE `post_content` LIKE '%[checkout]%' AND `post_type` NOT IN('revision') LIMIT 1");
if ($check_chekout != null) {
$wpsc_pageurl_option['checkout_url'] = '[checkout]';
} else {
$wpsc_pageurl_option['checkout_url'] = '[checkout]';
}
$wpsc_pageurl_option['transact_url'] = '[transactionresults]';
$wpsc_pageurl_option['user_account_url'] = '[userlog]';
$changes_made = false;
foreach ($wpsc_pageurl_option as $option_key => $page_string) {
$post_id = $wpdb->get_var("SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` IN('page','post') AND `post_content` LIKE '%{$page_string}%' AND `post_type` NOT IN('revision') LIMIT 1");
$the_new_link = _get_page_link($post_id);
if (stristr(get_option($option_key), "https://")) {
$the_new_link = str_replace('http://', "https://", $the_new_link);
}
update_option($option_key, $the_new_link);
}
return $content;
}
示例7: translate_link
function translate_link($link, $lang = null)
{
$lang = $lang ? $lang : $this->get_current_language();
if (!$lang) {
return $link;
}
if (wpbdp_rewrite_on()) {
$main_id = wpbdp_get_page_id('main');
$trans_id = icl_object_id($main_id, 'page', false, $lang);
if (!$trans_id) {
return $link;
}
$link = str_replace(_get_page_link($main_id), _get_page_link($trans_id), $link);
$link = add_query_arg('lang', $lang, $link);
} else {
$link = add_query_arg('lang', $lang, $link);
}
return $link;
}
示例8: wpsc_update_permalink_slugs
/**
* Updates permalink slugs
*
* @since 3.8.9
* @return type
*/
function wpsc_update_permalink_slugs()
{
global $wpdb;
$wpsc_pageurl_option = array('product_list_url' => '[productspage]', 'shopping_cart_url' => '[shoppingcart]', 'checkout_url' => '[shoppingcart]', 'transact_url' => '[transactionresults]', 'user_account_url' => '[userlog]');
$ids = array();
foreach ($wpsc_pageurl_option as $option_key => $page_string) {
$id = $wpdb->get_var("SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` = 'page' AND `post_content` LIKE '%{$page_string}%' LIMIT 1");
if (!$id) {
continue;
}
$ids[$page_string] = $id;
$the_new_link = _get_page_link($id);
if (stristr(get_option($option_key), "https://")) {
$the_new_link = str_replace('http://', "https://", $the_new_link);
}
if ($option_key == 'shopping_cart_url') {
update_option('checkout_url', $the_new_link);
}
update_option($option_key, $the_new_link);
}
update_option('wpsc_shortcode_page_ids', $ids);
}
示例9: get_attachment_link
function get_attachment_link($id = false)
{
global $post, $wp_rewrite;
$link = false;
if (!$id) {
$id = (int) $post->ID;
}
$object = get_post($id);
if ($wp_rewrite->using_permalinks() && $object->post_parent > 0 && $object->post_parent != $id) {
$parent = get_post($object->post_parent);
if ('page' == $parent->post_type) {
$parentlink = _get_page_link($object->post_parent);
} else {
$parentlink = get_permalink($object->post_parent);
}
if (is_numeric($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%')) {
$name = 'attachment/' . $object->post_name;
} else {
$name = $object->post_name;
}
if (strpos($parentlink, '?') === false) {
$link = user_trailingslashit(trailingslashit($parentlink) . $name);
}
}
if (!$link) {
$link = get_bloginfo('url') . "/?attachment_id={$id}";
}
return apply_filters('attachment_link', $link, $id);
}
示例10: wpmlm_install
function wpmlm_install()
{
global $wpdb, $user_level, $wp_rewrite, $wp_version, $wpmlm_page_titles;
$table_name = $wpdb->prefix . "wpmlm_product_list";
$first_install = false;
if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") !== $table_name) {
// Table doesn't exist
$first_install = true;
add_option('wpmlm_purchaselogs_fixed', true);
}
// run the create or update code here.
wpmlm_create_or_update_tables();
wpmlm_create_upload_directories();
// All code to add new database tables and columns must be above here
$wpmlm_version = get_option('wpmlm_version', 0);
$wpmlm_minor_version = get_option('wspc_minor_version', 0);
if ($wpmlm_version === false) {
add_option('wpmlm_version', WPMLM_VERSION, '', 'yes');
} else {
update_option('wpmlm_version', WPMLM_VERSION);
}
if ($wpmlm_minor_version === false) {
add_option('wpmlm_minor_version', WPMLM_MINOR_VERSION, '', 'yes');
} else {
update_option('wpmlm_minor_version', WPMLM_MINOR_VERSION);
}
if (version_compare($wpmlm_version, '3.8', '<')) {
update_option('wpmlm_needs_update', true);
} else {
update_option('wpmlm_needs_update', false);
}
wpmlm_product_files_htaccess();
/*
* This part creates the pages and automatically puts their URLs into the options page.
* As you can probably see, it is very easily extendable, just pop in your page and the deafult content in the array and you are good to go.
*/
$post_date = date("Y-m-d H:i:s");
$post_date_gmt = gmdate("Y-m-d H:i:s");
/*************| Create MLM Pages Menus |***********************************************************/
$mlmpages = array('my-networks-page' => array('name' => 'my-networks-page', 'title' => __('My Networks', 'wpmlm'), 'tag' => '[mynetworks]', 'option' => 'my_networks_url'), 'my-direct-group-details-page' => array('name' => 'my-direct-group-details-page', 'title' => __('My Direct Group Details', 'wpmlm'), 'tag' => '[mydirectgroup]', 'option' => 'my_direct_group_url'), 'my-left-group-details-page' => array('name' => 'my-left-group-details-page', 'title' => __('My Left Group Details', 'wpmlm'), 'tag' => '[myleftgroup]', 'option' => 'my_left_group_url'), 'my-right-group-details-page' => array('name' => 'my-right-group-details-page', 'title' => __('My Right Group Details', 'wpmlm'), 'tag' => '[myrightgroup]', 'option' => 'my_right_group_url'), 'my-consultants-page' => array('name' => 'my-consultants-page', 'title' => __('My Consultants', 'wpmlm'), 'tag' => '[myconsultant]', 'option' => 'my_consultant_url'), 'unpaid-details-page' => array('name' => 'unpaid-details-page', 'title' => __('Unpaid Consultants', 'wpmlm'), 'tag' => '[unpaidconsultant]', 'option' => 'my_unpaid_consultant_url'), 'my-geneology' => array('name' => 'my-geneology', 'title' => __('View Geneology', 'wpmlm'), 'tag' => '[mygeneology]', 'option' => 'my_geneology_url'), 'registration-page' => array('name' => 'registration-page', 'title' => __('Registration', 'wpmlm'), 'tag' => '[registration]', 'option' => 'registration_url'));
//indicator. if we will create any new pages we need to flush.. :)
$newmlmpages = false;
//get desktop page id. if there's no products page then create one
$network_page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $mlmpages['my-networks-page']['tag'] . "%'\tAND `post_type` != 'revision'");
if (empty($network_page_id)) {
$network_page_id = wp_insert_post(array('post_title' => $mlmpages['my-networks-page']['title'], 'post_type' => 'page', 'post_name' => $mlmpages['my-networks-page']['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $mlmpages['my-networks-page']['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0));
$newmlmpages = true;
}
update_option($mlmpages['my-networks-page']['option'], _get_page_link($network_page_id));
//done. desktop page created. no we can unset products page data and create all other pages.
//unset desktop page
unset($mlmpages['my-networks-page']);
/*Registration Page */
$registration_page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $mlmpages['registration-page']['tag'] . "%'\tAND `post_type` != 'revision'");
if (empty($registration_page_id)) {
$registration_page_id = wp_insert_post(array('post_title' => $mlmpages['registration-page']['title'], 'post_type' => 'page', 'post_name' => $mlmpages['registration-page']['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $mlmpages['registration-page']['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0));
$newmlmpages = true;
}
update_option($mlmpages['registration-page']['option'], _get_page_link($registration_page_id));
//done. Registration page created. no we can unset products page data and create all other pages.
//unset Registration Page
unset($mlmpages['registration-page']);
//create other pages
foreach ((array) $mlmpages as $page) {
//check if page exists and get it's ID
$page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $page['tag'] . "%'\tAND `post_type` != 'revision'");
//if there's no page - create
if (empty($page_id)) {
$page_id = wp_insert_post(array('post_title' => $page['title'], 'post_type' => 'page', 'post_name' => $page['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $page['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0, 'post_parent' => $network_page_id));
$newmlmpages = true;
}
//update option
update_option($page['option'], get_permalink($page_id));
//also if this is shopping_cart, then update checkout url option
}
//if we have created any new pages, then flush... do we need to do this? probably should be removed
if ($newmlmpages) {
wp_cache_delete('all_page_ids', 'mlmpages');
$wp_rewrite->flush_rules();
}
/***********| End of the creation of menus and its items |*********************************************/
// Product categories, temporarily register them to create first default category if none exist
// @todo: investigate those require once lines and move them to right place (not from here, but from their original location, which seems to be wrong, since i cant access wpmlm_register_post_types and wpmlm_update_categorymeta here) - Vales <v.bakaitis@gmail.com>
require_once WPMLM_FILE_PATH . '/wpmlm-core/wpmlm-functions.php';
/*add options for MLM settings*/
$wpmlm_general_settings_value = array('status1' => 'Beginer', 'status1criteria' => '30', 'status2' => 'Intermediate', 'status2criteria' => '30', 'status3' => 'Advance', 'status3criteria' => '100');
add_option('wpmlm_general_settings', $wpmlm_general_settings_value);
$wpmlm_eligibility_settings_value = array('minpersonalpv' => '100', 'directreferrer' => '2', 'group1referrer' => '1', 'group2referrer' => '1', 'minpveachreferrer' => '30');
add_option('wpmlm_eligibility_settings', $wpmlm_eligibility_settings_value);
$wpmlm_payout_settings_value = array('group1pv' => '100', 'group2pv' => '100', 'startingunitrate' => '1000', 'startingunits' => '3', 'additionalunitrate' => '800', 'caplimitamount' => '300000', 'servicecharges' => '100', 'tds' => '12.5');
add_option('wpmlm_payout_settings', $wpmlm_payout_settings_value);
}
示例11: wpsc_install
function wpsc_install()
{
global $wpdb, $user_level, $wp_rewrite, $wp_version, $wpsc_page_titles;
$table_name = $wpdb->prefix . "wpsc_product_list";
if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") !== $table_name) {
// Table doesn't exist
add_option('wpsc_purchaselogs_fixed', true);
}
// the only consistent and reliable way to detect whether this is a fresh install is by checking
// whether WPSC_TABLE_CART_CONTENTS exists. This is an unfortunate hack, but we can do away with
// it in 3.9 as we'll drop support for 3.7.x then
if ($wpdb->get_var("SHOW TABLES LIKE '" . WPSC_TABLE_CART_CONTENTS . "'") != WPSC_TABLE_CART_CONTENTS) {
add_option('wpsc_db_version', WPSC_DB_VERSION, '', 'no');
}
// run the create or update code here.
wpsc_create_or_update_tables();
wpsc_create_upload_directories();
// All code to add new database tables and columns must be above here
$wpsc_version = get_option('wpsc_version', 0);
$wpsc_minor_version = get_option('wpsc_minor_version', 0);
if ($wpsc_version === false) {
add_option('wpsc_version', WPSC_VERSION, '', 'no');
} else {
update_option('wpsc_version', WPSC_VERSION);
}
if ($wpsc_minor_version === false) {
add_option('wpsc_minor_version', WPSC_MINOR_VERSION, '', 'no');
} else {
update_option('wpsc_minor_version', WPSC_MINOR_VERSION);
}
if (version_compare($wpsc_version, '3.8', '<')) {
update_option('wpsc_needs_update', true);
} else {
update_option('wpsc_needs_update', false);
}
if ('' == get_option('show_subcatsprods_in_cat')) {
update_option('show_subcatsprods_in_cat', 0);
}
if ('' == get_option('wpsc_share_this')) {
update_option('wpsc_share_this', 0);
}
if ('' == get_option('wpsc_crop_thumbnails')) {
update_option('wpsc_crop_thumbnails', 0);
}
if ('' == get_option('wpsc_products_per_page')) {
update_option('wpsc_products_per_page', 0);
}
if ('' == get_option('wpsc_force_ssl')) {
update_option('wpsc_force_ssl', 0);
}
if ('' == get_option('use_pagination')) {
update_option('use_pagination', 0);
}
if ('' == get_option('hide_name_link')) {
update_option('hide_name_link', 0);
}
if ('' == get_option('wpsc_enable_comments')) {
update_option('wpsc_enable_comments', 0);
}
if ('' == get_option('multi_add')) {
update_option('multi_add', 1);
}
if ('' == get_option('hide_addtocart_button')) {
update_option('hide_addtocart_button', 0);
}
if ('' == get_option('wpsc_addtocart_or_buynow')) {
update_option('wpsc_addtocart_or_buynow', 0);
}
add_option('show_thumbnails', 1, '', 'no');
add_option('show_thumbnails_thickbox', 1, '', 'no');
require_once WPSC_FILE_PATH . '/wpsc-core/wpsc-functions.php';
require_once WPSC_FILE_PATH . '/wpsc-includes/wpsc-theme-engine-bootstrap.php';
if (!_wpsc_maybe_activate_theme_engine_v2()) {
add_option('product_list_url', '', '', 'no');
add_option('shopping_cart_url', '', '', 'no');
add_option('checkout_url', '', '', 'no');
add_option('transact_url', '', '', 'no');
/*
* This part creates the pages and automatically puts their URLs into the options page.
* As you can probably see, it is very easily extendable, just pop in your page and the deafult content in the array and you are good to go.
*/
$post_date = date("Y-m-d H:i:s");
$post_date_gmt = gmdate("Y-m-d H:i:s");
$pages = array('products-page' => array('name' => 'products-page', 'title' => __('Products Page', 'wpsc'), 'tag' => '[productspage]', 'option' => 'product_list_url'), 'checkout' => array('name' => 'checkout', 'title' => __('Checkout', 'wpsc'), 'tag' => '[shoppingcart]', 'option' => 'shopping_cart_url'), 'transaction-results' => array('name' => 'transaction-results', 'title' => __('Transaction Results', 'wpsc'), 'tag' => '[transactionresults]', 'option' => 'transact_url'), 'your-account' => array('name' => 'your-account', 'title' => __('Your Account', 'wpsc'), 'tag' => '[userlog]', 'option' => 'user_account_url'));
//indicator. if we will create any new pages we need to flush.. :)
$newpages = false;
//get products page id. if there's no products page then create one
$products_page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $pages['products-page']['tag'] . "%'\tAND `post_type` != 'revision'");
if (empty($products_page_id)) {
$products_page_id = wp_insert_post(array('post_title' => $pages['products-page']['title'], 'post_type' => 'page', 'post_name' => $pages['products-page']['name'], 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $pages['products-page']['tag'], 'post_status' => 'publish', 'post_author' => 1, 'menu_order' => 0));
$newpages = true;
}
update_option($pages['products-page']['option'], _get_page_link($products_page_id));
//done. products page created. no we can unset products page data and create all other pages.
//unset products page
unset($pages['products-page']);
//create other pages
foreach ((array) $pages as $page) {
//check if page exists and get it's ID
$page_id = $wpdb->get_var("SELECT id FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%" . $page['tag'] . "%'\tAND `post_type` != 'revision'");
//.........这里部分代码省略.........
示例12: cc_get_slug
function cc_get_slug($page = '', $with_end_slash = true, $full_url = true)
{
if ('' != $page) {
$wpc_pages = $this->cc_get_settings('pages');
if (isset($wpc_pages[$page]) && 0 < $wpc_pages[$page]) {
$post = get_post($wpc_pages[$page]);
if (isset($post->post_name) && '' != $post->post_name) {
$url = '';
//parent exist
if (0 < $post->post_parent) {
$parent = get_post($post->post_parent);
$url = $parent->post_name . '/';
}
$url .= $post->post_name;
if ($full_url) {
if (is_multisite()) {
$url = get_home_url(get_current_blog_id()) . '/' . $url;
} else {
if ($this->permalinks) {
$url = get_home_url() . '/' . $url;
} else {
$url = _get_page_link($post);
}
}
}
$url = rtrim($url, '/');
if ($with_end_slash && $this->permalinks) {
$url = $url . '/';
}
return $url;
}
}
}
return '';
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:35,代码来源:class.common.php
示例13: get_post_comments_feed_link
/**
* Retrieve the permalink for the post comments feed.
*
* @since 2.2.0
*
* @param int $post_id Optional. Post ID.
* @param string $feed Optional. Feed type.
* @return string
*/
function get_post_comments_feed_link($post_id = '', $feed = '') {
global $id;
if ( empty($post_id) )
$post_id = (int) $id;
if ( empty($feed) )
$feed = get_default_feed();
if ( '' != get_option('permalink_structure') ) {
if ( 'page' == get_option('show_on_front') && $post_id == get_option('page_on_front') )
$url = _get_page_link( $post_id );
else
$url = get_permalink($post_id);
$url = trailingslashit($url) . 'feed';
if ( $feed != get_default_feed() )
$url .= "/$feed";
$url = user_trailingslashit($url, 'single_feed');
} else {
$type = get_post_field('post_type', $post_id);
if ( 'page' == $type )
$url = home_url("?feed=$feed&page_id=$post_id");
else
$url = home_url("?feed=$feed&p=$post_id");
}
return apply_filters('post_comments_feed_link', $url);
}
示例14: xili_nav_page_link_insertion_fixe
/**
* fixes filter for front-page array
* @since 2.8.5
*
*/
function xili_nav_page_link_insertion_fixe($link, $post_id, $sample)
{
global $xili_language;
//$front_page_id = $xili_language->get_option_wo_xili ('page_on_front');
$list_pages_check_option = $xili_language->xili_settings['list_pages_check_option'];
if ($xili_language->show_page_on_front && $list_pages_check_option == 'fixe' && in_array($post_id, $xili_language->show_page_on_front_array)) {
$post_id = (int) $post_id;
// issue with 3.4.2
$post = get_post($post_id);
$link = _get_page_link($post, false, $sample);
}
return $link;
}
示例15: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
echo '<style>
.custom-widget-wrap {background: #3C92CF; border-radius: 4px; padding: 24px 12px;}
.custom-widget-title {font-size: 14px; line-height: 20px; font-weight: 800; color: #fff; font-family: "Open Sans" !important;}
.custom-widget-text {color: #fff; text-align:justify; padding-bottom: 9px; line-height: 20px; font-family: "Open Sans" !important;}
.custom-widget-wrap img {display: inline-block; width: 80%; margin-bottom: -64px; margin-top: -32px;}
.custom-widget-separator-wrap {padding: 18px 0;}
.custom-widget-separator {border-bottom: 1px solid #fff;}
.custom-widget-form input {margin: 9px 0; border-radius: 4px; font-size: 14px; line-height: 22px; font-family: "Open Sans" !important;}
.custom-widget-form button[type="submit"] {padding: 12px 24px; background: #1874BA; color: #fff; font-weight: 800; border: none; transition: background 0.3s; line-height: 14px;}
.custom-widget-form button[type="submit"]:hover {background: #1E82CE;}
</style>';
echo '<script src="//code.jquery.com/jquery-2.1.0.min.js"></script>';
echo '<div class="custom-widget-wrap">';
echo $before_widget;
$title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
$textContent = empty($instance['textContent']) ? ' ' : apply_filters('widget_text', $instance['textContent']);
$textSuccess = empty($instance['textSuccess']) ? ' ' : apply_filters('widget_success', $instance['textSuccess']);
$recipient = empty($instance['recipient']) ? ' ' : apply_filters('widget_recipient', $instance['recipient']);
$subject = empty($instance['subject']) ? ' ' : apply_filters('widget_subject', $instance['subject']);
// $textContent = $instance['textContent'];
if (!empty($title)) {
echo '<div class="custom-widget-title">' . $title . '</div>';
}
if ($textContent) {
echo '
<div class="custom-widget-separator-wrap">
<div class="custom-widget-separator"></div>
</div>
<div class="custom-widget-text">' . $textContent . '</div>';
}
// WIDGET CODE GOES HERE
$using_permalink = get_option('permalink_structure');
$permalink = get_permalink();
// Fix For Static Page
if (get_option('show_on_front') == 'page' && is_page()) {
if (intval(get_option('page_on_front')) > 0) {
$permalink = _get_page_link();
}
}
//echo '<p class="contact">to: ' . $recipient . '<br />subj: ' . $subject . '<br />URL: <a href="'.plugins_url('sendMail.php', __FILE__).'">URL_link</a></p>';
echo '<form method="POST" class="custom-widget-form" action="javascript:alert("success!");">
<input style="width:100%;" name="URL_link" type="URL" placeholder="Please send us link to your site..." required/>
<button class="submit_btn" type="submit">SEND</button>
<input type="hidden" name="recipient" value="' . $recipient . '" />
<input type="hidden" name="subject" value="' . $subject . '"/>
</form>';
// Ajax script for POST method
echo '<script type="text/javascript">
$(document).ready(function(){
$(".custom-widget-form").submit(function(){
var str = $(this).serialize();
$.ajax({
type : "POST",
url : "' . plugins_url('sendMail.php', __FILE__) . '",
data : str,
success: function(msg){
if(msg) {
result = "<div class=\\"custom-widget-text\\">' . $textSuccess . '</div><br />";
$("form.custom-widget-form").hide();
} else {
result = "<div class=/"It must be some alien conspiracy... Keep ninja tuned!/"></div><br />"
}
$("form.custom-widget-form").hide();
$("form.custom-widget-form").html(result).slideDown("slow");
$("form.custom-widget-form").html(result);
}
});
return false;
});
});
</script>';
echo $after_widget;
echo '<div class="text-right">
<img src="http://www.shindiristudio.com/testing/wp-content/uploads/ninja-01.png" />';
echo '</div>';
echo '</div><div id="test"></div> ';
}