Widget Assistance

wpFetchCategoriesControl.zip (2.1 KB) We had a custom widget created to pull in and display our blog posts from a Wordpress website. The widget works fine except that it only pull the first 10 categories within the prompt to select for the widget to display. I’m not a JS expert and I’m not seeing anything as simple as “10” to try to increase within the JS file. I’ve attached that file along with a screenshot of the display after the button is pressed. I’m able to scroll down through the 10 categories but it doesn’t load an 11th.

The company we worked with is no longer available to take a look and I was hoping someone might see an easy fix to get us the remaining category options.

Wouldn’t let me upload the screenshot for some reason.

Hey Josh, I ran a cursory Google search on your issue and it seems like you may be category-limited by the default WordPress API.

Take a look at this: https://wordpress.stackexchange.com/questions/345416/wordpress-json-rest-api-displaying-10-categories-only

It seems like you should be able to append the
?per_page=100
URL parameter to your API call (line 237-ish in your attached .js file) and that would sort you out. Adjust accordingly if you don’t want to pull 100 categories.

I haven’t tested this out, so I’d highly recommend running this by someone at Percussion or testing in a dev environment. Good luck!

Hello Josh,

I tested John’s suggestion above at this url (https://dickinsonstatenews.com/wp-json/wp/v2/categories?per_page=100) and it is displaying all categories with that added query parameter. The change to line 237 should work.

$.get( wpRestURL + 'categories?per_page=100')
    .done( function( data ) {
      console.log( "Data: ", data );

Romario Mato
Customer Success Engineer

It worked! Now I have to try to figure out how to fix the overlap. I’ve tried some clearfix things I’ve found around but nothing really works. The widget loads overlapped but appears perfectly after the window is resized. https://www.dickinsonstate.edu/Testing/test002.html

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.