本文整理汇总了PHP中remove_query_arg函数的典型用法代码示例。如果您正苦于以下问题:PHP remove_query_arg函数的具体用法?PHP remove_query_arg怎么用?PHP remove_query_arg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_query_arg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_qs_add_to_cart_url
public function update_qs_add_to_cart_url($cart_url)
{
$ref_url = wp_get_referer();
$ref_url = remove_query_arg(array('added-to-cart', 'add-to-cart'), $ref_url);
$ref_url = add_query_arg(array('add-to-cart' => $this->id), $ref_url);
return $ref_url;
}
示例2: filter_add_to_cart_url
function filter_add_to_cart_url()
{
$ref_url = wp_get_referer();
$ref_url = remove_query_arg(array('added-to-cart', 'add-to-cart'), $ref_url);
$ref_url = add_query_arg(array('add-to-cart' => $this->id), $ref_url);
return esc_url($ref_url);
}
示例3: route_action
function route_action()
{
$nonce_action = $_REQUEST['bpmod-action'];
$action = $_REQUEST['bpmod-action'];
if ('bulk_contents' == $_REQUEST['bpmod-action'] || 'bulk_users' == $_REQUEST['bpmod-action']) {
$action .= '_' . $_REQUEST['bulk-action'];
}
$in_ajax = defined('DOING_AJAX');
if ($in_ajax) {
check_ajax_referer($nonce_action);
$response_func = array(&$this, 'ajax_' . $action);
} else {
check_admin_referer($nonce_action);
$response_func = array(&$this, 'action_' . $action);
$this->redir = remove_query_arg(array('err_ids', 'marked_spammer', 'unmarked_spammer', 'content_ignored', 'content_moderated', 'content_deleted'), wp_get_referer());
}
$handle_func = array(&$this, 'handle_' . $action);
$response_func = array(&$this, ($in_ajax ? 'ajax_' : 'action_') . $action);
if (is_callable($handle_func)) {
$result = (array) call_user_func($handle_func);
if ($result && is_callable($response_func)) {
call_user_func_array($response_func, $result);
}
}
//fallback if nothing has been called
if ($in_ajax) {
die(-1);
} else {
bp_core_redirect($this->redir);
}
}
示例4: farmtoyou_paging_nav
/**
* Display navigation to next/previous set of posts when applicable.
*
* @since Farmtoyou 1.0
*
* @global WP_Query $wp_query WordPress Query object.
* @global WP_Rewrite $wp_rewrite WordPress Rewrite object.
*/
function farmtoyou_paging_nav()
{
global $wp_query, $wp_rewrite;
// Don't print empty markup if there's only one page.
if ($wp_query->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $wp_rewrite->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base . '/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $wp_query->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('← Previous', 'farmtoyou'), 'next_text' => __('Next →', 'farmtoyou')));
if ($links) {
?>
<nav class="navigation paging-navigation" role="navigation">
<div class="pagination loop-pagination">
<?php
echo $links;
?>
</div><!-- .pagination -->
</nav><!-- .navigation -->
<?php
}
}
示例5: removeWpVersionFromLink
function removeWpVersionFromLink($src)
{
if (strpos($src, 'ver=')) {
$src = remove_query_arg('ver', $src);
}
return $src;
}
示例6: callback_submit_options
public function callback_submit_options()
{
global $wpsc_shipping_modules;
foreach ($wpsc_shipping_modules as $shipping) {
if (is_object($shipping)) {
$shipping->submit_form();
}
}
//This is for submitting shipping details to the shipping module
if (!isset($_POST['update_gateways'])) {
$_POST['update_gateways'] = '';
}
if (!isset($_POST['custom_shipping_options'])) {
$_POST['custom_shipping_options'] = array();
}
update_option('custom_shipping_options', array_map('sanitize_text_field', $_POST['custom_shipping_options']));
$shipadd = 0;
foreach ($wpsc_shipping_modules as $shipping) {
foreach ((array) $_POST['custom_shipping_options'] as $shippingoption) {
if ($shipping->getInternalName() == $shippingoption) {
$shipadd++;
}
}
}
if (isset($_POST['wpsc_options']['shipping_discount_value'])) {
update_option('shipping_discount_value', wpsc_string_to_float($_POST['wpsc_options']['shipping_discount_value']));
}
if (!get_option('do_not_use_shipping') && !get_option('custom_shipping_options') && !(bool) get_option('shipwire')) {
update_option('do_not_use_shipping', '1');
return array('shipping_disabled' => 1);
} else {
$_SERVER['REQUEST_URI'] = esc_url_raw(remove_query_arg('shipping_disabled'));
}
}
示例7: __construct
/**
* Constructor
*/
public function __construct()
{
$remove = array_diff(array_keys($_GET), $this->baseUrlParamNames);
if ($remove) {
$this->baseUrl = remove_query_arg($remove);
} else {
$this->baseUrl = $_SERVER['REQUEST_URI'];
}
parent::__construct();
// add special filter for url fields
$this->input->addFilter(create_function('$str', 'return "http://" == $str || "ftp://" == $str ? "" : $str;'));
// enqueue required sripts and styles
global $wp_styles;
if (!is_a($wp_styles, 'WP_Styles')) {
$wp_styles = new WP_Styles();
}
wp_enqueue_style('pmwi-admin-style', PMWI_ROOT_URL . '/static/css/admin.css', array(), PMWI_VERSION);
if (version_compare(get_bloginfo('version'), '3.8-RC1') >= 0) {
wp_enqueue_style('pmwi-admin-style-wp-3.8', PMWI_ROOT_URL . '/static/css/admin-wp-3.8.css');
}
wp_enqueue_script('pmwi-script', PMWI_ROOT_URL . '/static/js/pmwi.js', array('jquery'));
wp_enqueue_script('pmwi-admin-script', PMWI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-resizable', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'pmxi-admin-script'), PMWI_VERSION);
global $woocommerce;
$woocommerce_witepanel_params = array('remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'wpai_woocommerce_addon_plugin'), 'remove_attribute' => __('Remove this attribute?', 'wpai_woocommerce_addon_plugin'), 'name_label' => __('Name', 'wpai_woocommerce_addon_plugin'), 'remove_label' => __('Remove', 'wpai_woocommerce_addon_plugin'), 'click_to_toggle' => __('Click to toggle', 'wpai_woocommerce_addon_plugin'), 'values_label' => __('Value(s)', 'wpai_woocommerce_addon_plugin'), 'text_attribute_tip' => __('Enter some text, or some attributes by pipe (|) separating values.', 'wpai_woocommerce_addon_plugin'), 'visible_label' => __('Visible on the product page', 'wpai_woocommerce_addon_plugin'), 'used_for_variations_label' => __('Used for variations', 'wpai_woocommerce_addon_plugin'), 'new_attribute_prompt' => __('Enter a name for the new attribute term:', 'wpai_woocommerce_addon_plugin'), 'calc_totals' => __("Calculate totals based on order items, discount amount, and shipping? Note, you will need to (optionally) calculate tax rows and cart discounts manually.", 'wpai_woocommerce_addon_plugin'), 'calc_line_taxes' => __("Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.", 'wpai_woocommerce_addon_plugin'), 'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.", 'wpai_woocommerce_addon_plugin'), 'load_billing' => __("Load the customer's billing information? This will remove any currently entered billing information.", 'wpai_woocommerce_addon_plugin'), 'load_shipping' => __("Load the customer's shipping information? This will remove any currently entered shipping information.", 'wpai_woocommerce_addon_plugin'), 'featured_label' => __('Featured', 'wpai_woocommerce_addon_plugin'), 'tax_or_vat' => $woocommerce->countries->tax_or_vat(), 'prices_include_tax' => get_option('woocommerce_prices_include_tax'), 'round_at_subtotal' => get_option('woocommerce_tax_round_at_subtotal'), 'meta_name' => __('Meta Name', 'wpai_woocommerce_addon_plugin'), 'meta_value' => __('Meta Value', 'wpai_woocommerce_addon_plugin'), 'no_customer_selected' => __('No customer selected', 'wpai_woocommerce_addon_plugin'), 'tax_label' => __('Tax Label:', 'wpai_woocommerce_addon_plugin'), 'compound_label' => __('Compound:', 'wpai_woocommerce_addon_plugin'), 'cart_tax_label' => __('Cart Tax:', 'wpai_woocommerce_addon_plugin'), 'shipping_tax_label' => __('Shipping Tax:', 'wpai_woocommerce_addon_plugin'), 'plugin_url' => $woocommerce->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'add_order_item_nonce' => wp_create_nonce("add-order-item"), 'add_attribute_nonce' => wp_create_nonce("add-attribute"), 'calc_totals_nonce' => wp_create_nonce("calc-totals"), 'get_customer_details_nonce' => wp_create_nonce("get-customer-details"), 'search_products_nonce' => wp_create_nonce("search-products"), 'calendar_image' => $woocommerce->plugin_url() . '/assets/images/calendar.png', 'post_id' => null);
wp_localize_script('woocommerce_writepanel', 'woocommerce_writepanel_params', $woocommerce_witepanel_params);
wp_enqueue_style('pmwi-woo-style', $woocommerce->plugin_url() . '/assets/css/admin.css');
}
示例8: setup
/**
* Set up the view with data and do things that are specific for this view
*
* @since 1.0.0
*
* @param string $action Action for this view
* @param array $data Data for this view
*/
public function setup($action, $data)
{
parent::setup($action, $data);
add_thickbox();
$this->admin_page->enqueue_script('list', array('jquery'), array('list' => array('shortcode_popup' => __('To embed this table into a post or page, use this Shortcode:', 'tablepress'), 'donation-message-already-donated' => __('Thank you very much! Your donation is highly appreciated. You just contributed to the further development of TablePress!', 'tablepress'), 'donation-message-maybe-later' => sprintf(__('No problem! I still hope you enjoy the benefits that TablePress adds to your site. If you should change your mind, you\'ll always find the “Donate” button on the <a href="%s">TablePress website</a>.', 'tablepress'), 'http://tablepress.org/'))));
if ($data['messages']['first_visit']) {
$this->add_header_message('<strong><em>' . __('Welcome!', 'tablepress') . '</em></strong><br />' . __('Thank you for using TablePress for the first time!', 'tablepress') . ' ' . sprintf(__('If you encounter any questions or problems, please visit the <a href="%1$s">FAQ</a>, the <a href="%2$s">documentation</a>, and the <a href="%3$s">Support</a> section on the <a href="%4$s">plugin website</a>.', 'tablepress'), 'http://tablepress.org/faq/', 'http://tablepress.org/documentation/', 'http://tablepress.org/support/', 'http://tablepress.org/') . '<br /><br />' . $this->ajax_link(array('action' => 'hide_message', 'item' => 'first_visit', 'return' => 'list'), __('Hide this message', 'tablepress')));
}
if ($data['messages']['wp_table_reloaded_warning']) {
$this->add_header_message('<strong><em>' . __('Attention!', 'tablepress') . '</em></strong><br />' . __('You have activated the plugin WP-Table Reloaded, which can not be used together with TablePress.', 'tablepress') . '<br />' . __('It is strongly recommended that you switch from WP-Table Reloaded to TablePress, which not only fixes many problems, but also has more and better features than WP-Table Reloaded.', 'tablepress') . '<br />' . sprintf(__('Please follow the <a href="%s">migration guide</a> to move your tables and then deactivate WP-Table Reloaded!', 'tablepress'), 'http://tablepress.org/migration-from-wp-table-reloaded/') . '<br />' . '<a href="' . TablePress::url(array('action' => 'import')) . '" class="button button-primary button-large" title="' . __('Import your tables from WP-Table Reloaded', 'tablepress') . '" style="color:#ffffff;margin-top:5px;">' . __('Import your tables from WP-Table Reloaded', 'tablepress') . '</a>', 'error');
}
if ($data['messages']['donation_message']) {
$this->add_header_message('<img alt="' . __('Tobias Bäthge, developer of TablePress', 'tablepress') . '" src="https://secure.gravatar.com/avatar/50f1cff2e27a1f522b18ce229c057bc5?s=94" height="94" width="94" style="float:left;margin-right:10px;" />' . __('Hi, my name is Tobias, I\'m the developer of the TablePress plugin.', 'tablepress') . '<br /><br />' . __('Thanks for using it! You\'ve installed TablePress over a month ago.', 'tablepress') . ' ' . sprintf(_n('If everything works and you are satisfied with the results of managing your %s table, isn\'t that worth a coffee or two?', 'If everything works and you are satisfied with the results of managing your %s tables, isn\'t that worth a coffee or two?', $data['table_count'], 'tablepress'), $data['table_count']) . '<br/>' . sprintf(__('<a href="%s">Donations</a> help me to continue user support and development of this <em>free</em> software — things for which I spend countless hours of my free time! Thank you very much!', 'tablepress'), 'http://tablepress.org/donate/') . '<br/><br />' . __('Sincerly, Tobias', 'tablepress') . '<br /><br />' . sprintf('<a href="%s" target="_blank"><strong>%s</strong></a>', 'http://tablepress.org/donate/', __('Sure, I\'ll buy you a coffee and support TablePress!', 'tablepress')) . ' · ' . $this->ajax_link(array('action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'already-donated'), __('I already donated.', 'tablepress')) . ' · ' . $this->ajax_link(array('action' => 'hide_message', 'item' => 'donation_nag', 'return' => 'list', 'target' => 'maybe-later'), __('No, thanks. Don\'t ask again.', 'tablepress')));
}
if ($data['messages']['show_plugin_update']) {
$message = '<strong><em>' . sprintf(__('Thank you for updating to TablePress %s!', 'tablepress'), TablePress::version) . '</em></strong><br />';
if (!empty($data['messages']['plugin_update_message'])) {
$message .= $data['messages']['plugin_update_message'] . '<br />';
}
$message .= sprintf(__('Please read the <a href="%s">release announcement</a> for more information.', 'tablepress'), 'http://tablepress.org/news/') . ' ' . sprintf(__('If you like the new features and enhancements, <a href="%s">giving a donation</a> towards the further support and development of TablePress is recommended. Thank you!', 'tablepress'), 'http://tablepress.org/donate/') . '<br /><br />';
$message .= $this->ajax_link(array('action' => 'hide_message', 'item' => 'plugin_update', 'return' => 'list'), __('Hide this message', 'tablepress'));
$this->add_header_message($message);
}
$this->process_action_messages(array('success_delete' => _n('The table was deleted successfully.', 'The tables were deleted successfully.', 1, 'tablepress'), 'success_delete_plural' => _n('The table was deleted successfully.', 'The tables were deleted successfully.', 2, 'tablepress'), 'error_delete' => __('Error: The table could not be deleted.', 'tablepress'), 'error_save' => __('Error: The table could not be saved.', 'tablepress'), 'success_copy' => _n('The table was copied successfully.', 'The tables were copied successfully.', 1, 'tablepress'), 'success_copy_plural' => _n('The table was copied successfully.', 'The tables were copied successfully.', 2, 'tablepress'), 'error_copy' => __('Error: The table could not be copied.', 'tablepress'), 'error_no_table' => __('Error: You did not specify a valid table ID.', 'tablepress'), 'error_load_table' => __('Error: This table could not be loaded!', 'tablepress'), 'error_bulk_action_invalid' => __('Error: This bulk action is invalid!', 'tablepress'), 'error_no_selection' => __('Error: You did not select any tables!', 'tablepress'), 'error_delete_not_all_tables' => __('Notice: Not all selected tables could be deleted!', 'tablepress'), 'error_copy_not_all_tables' => __('Notice: Not all selected tables could be copied!', 'tablepress'), 'success_import' => __('The tables were imported successfully.', 'tablepress'), 'success_import_wp_table_reloaded' => __('The tables were imported successfully from WP-Table Reloaded.', 'tablepress')));
$this->add_text_box('head', array($this, 'textbox_head'), 'normal');
$this->add_text_box('tables-list', array($this, 'textbox_tables_list'), 'normal');
add_screen_option('per_page', array('label' => __('Tables', 'tablepress'), 'default' => 20));
// Admin_Controller contains function to allow changes to this in the Screen Options to be saved
$this->wp_list_table = new TablePress_All_Tables_List_Table();
$this->wp_list_table->set_items($this->data['tables']);
$this->wp_list_table->prepare_items();
// cleanup Request URI string, which WP_List_Table uses to generate the sort URLs
$_SERVER['REQUEST_URI'] = remove_query_arg(array('message', 'table_id'), $_SERVER['REQUEST_URI']);
}
示例9: admin_settings
public function admin_settings()
{
$uri = 'options-general.php?page=' . $this->args['domain'];
$sub = isset($_GET['sub']) ? trim($_GET['sub']) : 'general';
$subs = $this->getFilters($this->component . '_settings_subs', array());
$messages = $this->getFilters($this->component . '_settings_messages', array());
$titles = $this->getFilters($this->component . '_settings_titles', array());
echo '<div class="wrap -settings-wrap">';
printf('<h1>%s</h1>', isset($titles['title']) ? $titles['title'] : $this->args['title']);
gPluginFormHelper::headerNav($uri, $sub, $subs);
if (!empty($_GET['message'])) {
if (empty($messages[$_REQUEST['message']])) {
gPluginHTML::notice($_REQUEST['message'], 'notice-error');
} else {
echo $messages[$_REQUEST['message']];
}
$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
}
$file = $this->constants['plugin_dir'] . 'admin/' . $this->component . '.admin.' . $sub . '.php';
if (file_exists($file)) {
require_once $file;
} else {
do_action($this->args['domain'] . '_' . $this->component . '_settings_sub_' . $sub, $uri, $sub);
}
echo '<div class="clear"></div></div>';
}
示例10: shortcode
public function shortcode($atts, $content = null)
{
extract(shortcode_atts(array('fullwidth' => 'true', 'height' => '500', 'src' => '', 'margin_top' => '0', 'margin_bottom' => '0'), $atts));
$fullwidth = apply_filters('dt_sanitize_flag', $fullwidth);
$margin_top = intval($margin_top);
$margin_bottom = intval($margin_bottom);
$height = absint($height);
$height = $height ? $height : 500;
if (!$src && !$content) {
return '';
}
$classes = array('map-container');
if ($fullwidth) {
$classes[] = 'full';
}
$style = array('margin-top: ' . $margin_top . 'px', 'margin-bottom: ' . $margin_bottom . 'px');
$style = implode(';', $style);
$classes = implode(' ', $classes);
if (!$src && $content) {
if (preg_match('/iframe/', $content)) {
$content = str_replace(array('”', '″'), '"', $content);
preg_match('/src=(["\'])(.*?)\\1/', htmlspecialchars_decode($content), $match);
if (!empty($match[2])) {
$src = $match[2];
} else {
return '';
}
} else {
$src = $content;
}
}
$src = add_query_arg('output', 'embed', remove_query_arg('output', $src));
$output = '<div class="' . esc_attr($classes) . '" style="' . esc_attr($style) . '"><iframe src="' . esc_url($src) . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="500" height="' . $height . '"></iframe></div>';
return $output;
}
示例11: to_html
public function to_html()
{
$settings = $this->data['settings'];
$fields = array('plugin_enabled' => array('id' => 'plugin_enabled', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Content Protection', 'membership2'), 'desc' => __('This setting toggles the content protection on this site.', 'membership2'), 'value' => MS_Plugin::is_enabled(), 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'plugin_enabled')), 'hide_admin_bar' => array('id' => 'hide_admin_bar', 'type' => MS_Helper_Html::INPUT_TYPE_RADIO_SLIDER, 'title' => __('Hide admin toolbar', 'membership2'), 'desc' => __('Hide the admin toolbar for non administrator users.', 'membership2'), 'value' => $settings->hide_admin_bar, 'data_ms' => array('action' => MS_Controller_Settings::AJAX_ACTION_TOGGLE_SETTINGS, 'setting' => 'hide_admin_bar')));
$fields = apply_filters('ms_view_settings_prepare_general_fields', $fields);
$setup = MS_Factory::create('MS_View_Settings_Page_Setup');
$action_url = esc_url_raw(remove_query_arg(array('msg')));
ob_start();
MS_Helper_Html::settings_tab_header();
?>
<form action="<?php
echo esc_url($action_url);
?>
" method="post" class="cf">
<div class="cf">
<div class="ms-half">
<?php
MS_Helper_Html::html_element($fields['plugin_enabled']);
?>
</div>
<div class="ms-half">
<?php
MS_Helper_Html::html_element($fields['hide_admin_bar']);
?>
</div>
</div>
<?php
MS_Helper_Html::html_separator();
MS_Helper_Html::html_element($setup->html_full_form());
?>
</form>
<?php
return ob_get_clean();
}
示例12: flat_paging_nav
function flat_paging_nav()
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 4, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-chevron-left"></i>', 'flat'), 'next_text' => __('<i class="fa fa-chevron-right"></i>', 'flat')));
$allowed_html = array('a' => array('href' => array(), 'class' => array()), 'span' => array('class' => array()), 'i' => array('class' => array()));
if ($links) {
?>
<nav class="navigation paging-navigation" role="navigation">
<div class="nav-links">
<?php
echo wp_kses($links, $allowed_html);
?>
</div>
</nav>
<?php
}
}
示例13: remove_staticfiles_version
/**
* Remove version on static files
*/
function remove_staticfiles_version($src)
{
if (strpos($src, '?ver=')) {
$src = remove_query_arg('ver', $src);
}
return $src;
}
示例14: pagination
function pagination($pages = '', $range = 4)
{
// Don't print empty markup if there's only one page.
if ($GLOBALS['wp_query']->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
// Set up paginated links.
$links = paginate_links(array('base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map('urlencode', $query_args), 'prev_text' => __('<i class="fa fa-angle-left"></i>', 'crunchpress'), 'next_text' => __('<i class="fa fa-angle-right"></i>', 'crunchpress')));
if ($links) {
?>
<div class="pagination-all pagination" role="navigation">
<ul id='pagination'>
<li>
<?php
echo $links;
?>
</li>
</ul><!-- .pagination -->
</div><!-- .navigation -->
<?php
}
}
示例15: gazeta_the_posts_pagination
function gazeta_the_posts_pagination($query, $echo = true)
{
$pagination = '';
global $wp_query;
if (empty($query)) {
$query = $wp_query;
}
if ($query->max_num_pages < 2) {
return;
}
$paged = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
$pagenum_link = html_entity_decode(get_pagenum_link());
$query_args = array();
$url_parts = explode('?', $pagenum_link);
if (isset($url_parts[1])) {
wp_parse_str($url_parts[1], $query_args);
}
$pagenum_link = remove_query_arg(array_keys($query_args), $pagenum_link);
$pagenum_link = trailingslashit($pagenum_link) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && !strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit('page/%#%', 'paged') : '?paged=%#%';
$args = array('base' => $pagenum_link, 'format' => $format, 'total' => $query->max_num_pages, 'current' => $paged, 'mid_size' => 3, 'type' => 'list', 'add_args' => array_map('urlencode', $query_args), 'prev_text' => '<i class="fa fa-angle-double-left"></i>', 'next_text' => '<i class="fa fa-angle-double-right"></i>', 'before_page_number' => '<span>', 'after_page_number' => '</span>');
// Set up paginated links.
$pagination = paginate_links(apply_filters('gazeta_old_navigation_args', $args));
if ($pagination) {
if ($echo === false) {
return '<nav class="navigation pagination"><div class="nav-links">' . $pagination . '</div></nav>';
} else {
echo '<nav class="navigation pagination"><div class="nav-links">';
echo $pagination;
echo '</div></nav>';
}
}
}