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?
- Calling a method from functions.php on a click of a button
- How to change featured content to a different tag in WordPress Twenty Fourteen?
- How do I create comment-reply-button using element not
- WordPress menu deletes when trying to add a hook
- Overriding a theme redux file in child theme
- Making Quote Plugin more efficient
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- allow subscribers to see private posts without plug in
- Fatal error: Uncaught Error: Call to undefined function test()
- Display Data in Table from External Database in WP using Shortcodes
- Remove item in Checkout
- How to get current post category details inside “loop”?
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- Add Block Before Entry Title Using PHP
- Dynamically populate parameter in Gravity Forms using PHP
- Store ajax data in PHP variable
- comment_post (if comment is approved OR $comment_approved === 1) not working?
- How to edit post meta data before publishing the post it self wordpress?
- How can i create a function tag in my plugin
- Including user data in “new user notification email”
- get Woocommerce product format json for WP_Query
- Refresh page after login with litespeed cache
- Return newly created category by code
- remove_action() not working in page template – Genesis
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- Dropdown menu on custom menu
- How can the searchform.php know if it’s used on a registered sidebar id ‘sidebar-1’ or ‘sidebar-2’?
- WordPress get_post_meta issue
- Woocommerce Price Text
- Display custom meta box in my template file
- Contact form with dynamic dropdown and filter
- Critical Error customiser
- How to limit the number of posts in the wordpress loop in conjunction with the “download more” button?
- Need help with conditional logic for menus