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?
- Sections dependent on checkbox the WordPress WP_Customize_Control
- Strip from or something better?
- Add a select-option to the default widgets
- Defining multiple categories for showing latest posts
- the_post_thumbnail issues
- Is there a way to create a “copy post” link?
- Some problems calling a function into sprintf() inside functions.php template file [closed]
- Display additional page templates and a sidebar on plugin activation
- Dynamic Menu drops pages?
- Adding a ‘style=’ bit to image_send_to_editor output
- Post Views Code Hacks
- Closing WP_LINK_PAGES DIV ID w/After Argmuent
- Aspx/Rss feed – failed to open stream: Redirection limit reached
- Adding an Unlinked Space in a Custom Function
- exclude custom post type from running a function
- Taxonomy term description with style, only if the description exists?
- Exclude function from running on a certain page
- Convert all uploaded PNG files to PNG-8 format
- AJAX function not working [closed]
- Migrating site, only header shows
- Customize field names in backend profile edit page through function.php [duplicate]
- Make table disappear when fields are left blank?
- Menu not styling. New menus functionality giving me a headache
- Get date function not working
- Pagination Not Working (pages duplicating content)
- Use of antispambot with $curauth->email
- Auto create Nextgen Gallery on post creation [closed]
- Uses for function: wp_update_user
- How do I call an external php non WordPress class into functions.php?
- Insert content into head tag with function
- Function to call either single post or category
- How to internationalize header image?
- Custom functions for string data calculations
- How are these PHP functions applied to a specific page in WordPress?