su_shortcode_display_posts_get_current_page

The shortcodes-ultimate su shortcode display posts get current page function.

Published Date - February 15, 2021

Description

su_shortcode_display_posts_get_current_page( $id );

Parameters

  1. $id


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_shortcode_display_posts_get_current_page' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/shortcodes/display-posts.php';
}

// The input(s). 
$id = null;

// NOTICE! Understand what this does before running.
$result = su_shortcode_display_posts_get_current_page( $id );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/shortcodes/display-posts.php

function su_shortcode_display_posts_get_current_page( $id ) {

	$key = su_shortcode_display_posts_get_pagination_key( $id );

	// phpcs:disable
	return isset( $_GET[ $key ] ) && is_numeric( $_GET[ $key ] ) && $_GET[ $key ] > 0
		? intval( $_GET[ $key ] )
		: 1;
	// phpcs:enable

}