The solution for me ended up being to simply remove the np_post_num() add_action hook altogether, and instead declare get_theme_mod() as the desired variable $option_pg_number. This allowed use of the returned number variable in a separate loop function controlled by $option_pg_number, instead of just printing the returned number value of ‘np_posts_per_page’ on the page.
$option_pg_number = get_theme_mod('np_posts_per_page', '5');
I think this could have been cleared up a lot faster if the WordPress Codex included more documentation on the usage of the various built in features. The codex focuses on setting up the settings and controls, but doesn’t offer much explanation on how to implement the controls on pages.
Related Posts:
- get_theme_mod outputs number when using WP_Customize_Cropped_Image_Control
- Getting text from custom field from customizer
- Using get_theme_mod with checkbox to display content
- Need help setting default setting value for radio button in theme customizer
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- Change the footer text on the login page
- How to remove a metabox from menu editor page?
- Dynamically change feature image in customiser
- One button to change all settings in theme customizer?
- Check if page parent has certain template
- Design view breaking on Pages
- if has theme mod
- Hooking new functions to actions + passing parameters
- How to add default images into theme customizer image control?
- Is $hook a global variable in WordPress
- Crop image from get_theme_mod Customizer field
- Insert all post IDs in new database table
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- Handling Body class based on Template
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Why ajax doesn’t work on certain wordpress hooks?
- Is it possible to intercept all ajax requests and get the parameters and the returns?
- WordPress Gravatar filter is removing my custom attributes
- Error in custom php function doesn’t exist
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Modify custom field input data before creating a new post
- how to make custom ajax handler?
- Skt full width basic slideshow problem
- Omit custom post type from wp-sitemap.xml based on meta key using wp_sitemaps_posts_query_args
- Run a code only on theme activation only during first activation
- How to check if a Customizer setting is set?
- Theme not calling Jquery properly
- WordPress redirect redirecting too many times or not at all
- Why does the post_type_link hook everything twice?
- Please show me how to use an if/else statement in combination with wp_enqueue
- How to have different site identity logos on each page on Astra Theme [closed]
- How can I hook into the wp_mail function used by BackWPup?
- Get user custom field value on function.php
- Adding function to child theme’s function.php
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- Must filter functions receive all arguments passed to them?
- Creating customized php files in theme folder
- Dynamically Generate Functions and Hooks
- Need advice on theme customizer and child themes
- How to pass hook variable to function?
- How do I add a function to parent theme
- Contain multiple page templates in one PHP custom template file in WordPress?
- Wp_Schedule_Event every few minutes doesn’t work
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Adding custom field to product category and show it to shop/category shop page
- Custom meta box is not displaying value showing tag as empty
- Discount in the specific product title using keyword ( Woocoommerce )
- How do I get the value of a current user’s custom field?
- Hook into all password resets in WordPress and get password before hashing?
- Getting page / post URL on publish and / or update
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Why transition_post_type hook is called twice for the same post?
- Access preview settings in php
- WordPress HTML Helper
- How to add button to top of theme customizer?
- How can I clear the theme mod settings?
- Cant get theme to change footer color through theme customizer
- Assign new post author IF another user in custom field on post transition
- Create and publish a new post every Monday, listing the post titles and links to the posts published during the previous week
- transition_post_status hook, works – but not if the post is new
- Is there a hook that I can use when a fatal error occurs?
- How to make a image-size selected by default in Media upload – WP v3.5
- Hide main div if wp_nav_menu is empty
- How to draw media details for Isotope gallery using Photoswipe
- show limited tags in an article
- Theme Customizer – Dynamic CSS PHP File
- Using a function written in my functions.php file within the header.php file
- Woocommerce: Is it possible to overide the settings for allowing to purchase out of stock products [closed]
- How to prevent WP_Query function from returning all posts when empty?
- wp_trim_words() does not work with my code Am I doing any mistake in my code?
- foreach loop still echoes array
- dynamic dependent select dropdown
- Content filter won’t work
- Warning: in_array() null given in PHP function
- use loop to return blog details
- Customizer: How to change Header Image description
- Fetching Initials of the Commentator in the WordPress Website
- Why doesn’t global $wp_query not get hooked?
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- WP Container Displaying Only on First Page of Archive
- How to move a post from one category to another
- How to override theme’s public static function inside of a trait?
- how to use 2 index.php file One for mobile and one for desktop
- How can I export data without using any import/export plugin
- Add disclaimer before certain posts and pages
- Use Custiomizer to setup meta theme color tag
- wordpress ajax return 0
- Post formating on Home page
- Search box background on a different page template
- WP Ecommerce: Display the “Order Notes” as column in the Sales Log [closed]
- A next page function with shortcode?
- What is the wrong with this function to enqueue the scripts and styles to the theme? [closed]
- Need help with conditional logic for menus
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only
- Custom Admin Menu Report for Specific User ID