Title: swani's Replies | WordPress.org

---

# swani

  [  ](https://wordpress.org/support/users/swani/)

 *   [Profile](https://wordpress.org/support/users/swani/)
 *   [Topics Started](https://wordpress.org/support/users/swani/topics/)
 *   [Replies Created](https://wordpress.org/support/users/swani/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/swani/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/swani/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/swani/engagements/)
 *   [Favorites](https://wordpress.org/support/users/swani/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/users/swani/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/swani/replies/page/2/?output_format=md)

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Rest API only returns 10 posts](https://wordpress.org/support/topic/rest-api-only-returns-10-posts-2/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rest-api-only-returns-10-posts-2/#post-12022100)
 * OK, after a few more hours I have something that I think will meet my needs. 
   The solution comes in two parts so that you can use what you need.
 * **Part 1**
    The first part was just to get all the results to return. I didn’t
   really solve that, but I did figure out that “posts_per_page” was wrong. I needed“
   per_page”. So, I should have used:
 * `https://example.com/wp-json/wp/v2/videos?per_page=100`
 * I set mine to 100 because that should be enough. If I end up with more than that
   I need a new solution anyway. Also, it actually returns the most recent posts,
   so it won’t actually break if that number is exceeded. I also read somewhere 
   that you can’t actually return more than 80 anyway but I can’t test that without
   adding 50 more videos and I’m not going to do that.
 * Answer source for part 1:
 * [https://developer.wordpress.org/rest-api/reference/posts/#arguments](https://developer.wordpress.org/rest-api/reference/posts/#arguments)
 * **Part 2**
    Once I got all of the posts to return, I noticed that the return 
   was really slow. This wasn’t surprising because it was pulling everything for
   each post. I only need a couple of fields so I wanted to cut that down. That 
   lead me to `_fields`. To fetch just the ID and title, you would do something 
   like this:
 * `https://example.com/wp-json/wp/v2/videos?per_page=100&_fields[]=id&_fields[]
   =title`
 * Remember that I’m fetching videos, to do the same for posts would be this:
 * `http://example.com/wp-json/wp/v2/posts?per_page=100&_fields[]=id&_fields[]=title`
 * I hope this is helpful. I’m going to stay subscribed to this thread because it
   still feels a little like a hack.
 * Answer source for part 2 (scroll to the very bottom):
 * [https://github.com/WP-API/WP-API/issues/446](https://github.com/WP-API/WP-API/issues/446)
 * Best,
    Swani
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Rest API only returns 10 posts](https://wordpress.org/support/topic/rest-api-only-returns-10-posts/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/rest-api-only-returns-10-posts/#post-12021900)
 * I didn’t mean to post this in “Fixing WordPress”. Reposted in the correct forum.
 * [https://wordpress.org/support/topic/rest-api-only-returns-10-posts-2](https://wordpress.org/support/topic/rest-api-only-returns-10-posts-2)
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Override System Date (not format or timezone)](https://wordpress.org/support/topic/override-system-date-not-format-or-timezone/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/override-system-date-not-format-or-timezone/#post-11806653)
 * I really like both of these ideas. Ultimately, the first one was just over my
   head. I sort of went with a hybrid of the two ideas. I created two websites, 
   one on my dev server, one on my local development environment and set up the 
   events slightly differently. Then I did a screen share with the client to demo
   both. I half way through the call, I deleted a bunch of the events to illustrate
   the last few bullets. The events can be restored, from the trash in bulk, so 
   that allowed me to show how the site changes as the event lineup changes.
 * Thank you both for your suggestions and taking the time to answer. I may still
   look at doing both of them if I have to do this a lot in the future. I hope this
   project is close enough to complete that I can limp through with my incomplete
   solution.
 * I do find it kind of funny with all the things that we can tell a computer to
   do, we can’t tell it what time it is. (Not easily, anyway).
 * Swani
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [pdf file link uses link not thumbnail](https://wordpress.org/support/topic/pdf-file-link-uses-link-not-thumbnail/)
 *  [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [7 years, 12 months ago](https://wordpress.org/support/topic/pdf-file-link-uses-link-not-thumbnail/#post-10497865)
 * I had the same problem but just solved it so I thought I’d add my steps. I found
   a plugin that is just for this called:
 * PDF Thumbnails Support Test
 * When you install it, you can go to tools and it lists the software needed to 
   run this feature and indicates whether or not each is installed. You need:
 * ImageMagick
    Imagick Ghostscript WordPress >= 4.7
 * The one that was not installed for me was Imagick. Luckily, you can go to the
   cPanel home page and find **Select PHP Version** under the Software heading. 
   Once there you can select the extensions that you want activated and Imagick 
   is one of them. I don’t know how to install Ghostscript or ImageMagick as those
   are not available options. I suppose you contact your hosting provider.
 * Hope this helps,
    Swani
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Duplicate script in my plugin](https://wordpress.org/support/topic/duplicate-script-in-my-plugin/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/duplicate-script-in-my-plugin/#post-10162098)
 * OK, I’m feeling a little silly. I just ignored the “handle” part of this completely.
   I switched the `if` statement to use the handle and it worked immediately. Did
   the same for the CSS with `wp_style_is` for anyone who has stumbled upon this
   thread for the same issue.
 * So, thank you both for your help. I do have one follow up question for either
   of you or anyone else. Let’s say I’m coding this for the wider world, rather 
   than just this client. The resource is Swipebox in this case, but it could have
   been anything. Since a handle is set by the developer, what is best practice 
   for avoiding this situation in general? I think part of the reason I made the
   mistake I did is that it seemed intuitive to me that using the file name would
   be the best way to find overlapping resources, since the most common type of 
   overlap would be a file that is taken from elsewhere, rather than coded yourself.
   Also, the Codex says:
 * > This would check if the script named ‘fluidVids.js’ is enqueued. If it is enqueued,
   > it does nothing. If it is not enqueued, the files are then registered and enqueued.
 * Since this says “named” I thought I needed to use the file name, rather than 
   the handle. And, as I said, that made the most sense to me as to how this function
   would work.
 * [@jakept](https://wordpress.org/support/users/jakept/) – You provided a link 
   to a StackExchange answer about how to get all the handles, but even if I did
   that, I wouldn’t really know what to check the list for. Does that make sense?
 * Swani
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Admin Default Sorting for Custom Post Type](https://wordpress.org/support/topic/admin-default-sorting-for-custom-post-type/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/admin-default-sorting-for-custom-post-type/#post-10088740)
 * This is why sleep is important kids. When I deactivated all of the plugins to
   make sure I didn’t have a conflict, I did it on the staging site (on a server)
   and checked the results on my local. I wasn’t even looking at the same website!
   I had a plugin that allows the admin to drag drop posts into order and it was
   overriding anything I did (as it should). That’s a fun way to spend 90 minutes.
   Blerg.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YoImages] using add_image_size removes image size from “Edit crop formats” page](https://wordpress.org/support/topic/using-add_image_size-removes-image-size-from-edit-crop-formats-page/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/using-add_image_size-removes-image-size-from-edit-crop-formats-page/#post-9585874)
 * Hi [@sirulli](https://wordpress.org/support/users/sirulli/),
 * I can see how a soft crop isn’t necessarily going to be missing any of the image,
   but that isn’t always the case. I think the easiest thing would be to give the
   example that I am working with.
 * I have a client who sells clothing. Each article of clothing has one image of
   a model wearing the item. Some of these images are very tall and skinny. They
   come from the photographer that way. So, let’s say the raw image is 1000×2000.
   The images on the website are 450×600. Still a tall image, but nowhere near as
   tall, in terms of aspect ratio, as 1500×2500. In fact, simple resize two 450 
   pixels wide would result in an image that is 450×750. So a soft crop to 450×600
   actually removes 150 pixels from the top or bottom of the image. What I want 
   to do is give my client the option of redoing the crop depending on whether the
   product is in the top or bottom half of the image. If the item is a sweater, 
   they might keep the crop as is, because the crop is set to crop the bottom off:
 * `add_image_size( 'shop_catalog', 450, 600, array( 'center', 'top' ) );`
 * But, if the item is a pair of pants or shoes, I want them to be able to recrop
   from the bottom. Obviously this would be done only for products that need it,
   but the code above that changes the default crop settings removes this crop size
   from the sizes available to recrop. Would you consider changing the plugin to
   allow this or maybe make it an option that can be enabled? I don’t have the programming
   chops to make that kind of change myself.
 * Regardless of the decision you come to, thanks very much for making this. I think
   it’s great.
 * Best,
    swani
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[YoImages] using add_image_size removes image size from “Edit crop formats” page](https://wordpress.org/support/topic/using-add_image_size-removes-image-size-from-edit-crop-formats-page/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [8 years, 10 months ago](https://wordpress.org/support/topic/using-add_image_size-removes-image-size-from-edit-crop-formats-page/#post-9494897)
 * OK, I have been playing around with this some more. It turns out that the part
   that makes this fail is the setting for the cropping behavior. Anything other
   than `true` will remove the image from the list of available crop sizes.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [“Add new Category” doesn’t refresh list of categories](https://wordpress.org/support/topic/add-new-category-doesnt-refresh-list-of-categories/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/add-new-category-doesnt-refresh-list-of-categories/#post-9422487)
 * OK, I get this error
 * > PHP Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\shopspool\
   > wp-admin\includes\plugin.php on line 1422
 * Line 1422 is the foreach loop below
 *     ```
       /**
        * Remove a top-level admin menu.
        *
        * @since 3.1.0
        *
        * @global array $menu
        *
        * @param string $menu_slug The slug of the menu.
        * @return array|bool The removed menu on success, false if not found.
        */
       function remove_menu_page( $menu_slug ) {
       	global $menu;
   
       	foreach ( $menu as $i => $item ) {
       		if ( $menu_slug == $item[2] ) {
       			unset( $menu[$i] );
       			return $item;
       		}
       	}
   
       	return false;
       }
       ```
   
 * I get this even when I disable all plugins and switch to 2017 theme. I did try
   a completely clean install and it works there. I’m not sure what to do next. 
   I can’t give the site to the client without this working.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [“Add new Category” doesn’t refresh list of categories](https://wordpress.org/support/topic/add-new-category-doesnt-refresh-list-of-categories/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/add-new-category-doesnt-refresh-list-of-categories/#post-9422367)
 * Hey t-p,
 * Thanks for the ideas. I tried clearing the cache in both FF and Chrome. It didn’t
   change anything. But, I do have some more info from additional testing.
    - The failure to update the list of categories also happens when you are on 
      the category management page. If I add a new category, the category is added,
      but the list remains the same until refresh.
    - This is also true when deleting categories. There is a message that tells 
      you the category will be permanently deleted, then there is a red backgroud
      on the item that is being deleted for a fraction of a second. But, it doesn’t
      disappear. If you refresh the page the category is gone.
 * Last thing. I did actually see this feature working this morning. It was on a
   site that I have not upgraded to WP 4.8.1 yet. I was actually disappointed that
   this could be related to the WP version. Anyone have this working on 4.8.1?
 * Swani
    -  This reply was modified 8 years, 11 months ago by [swani](https://wordpress.org/support/users/swani/).
 *   Forum: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
   
   In reply to: [Multiple Sites, Single Instance of WP using WordPress Address (URL)](https://wordpress.org/support/topic/multiple-sites-single-instance-of-wp-using-wordpress-address-url/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/multiple-sites-single-instance-of-wp-using-wordpress-address-url/#post-8818555)
 * Hey Amibe,
 * Someone mentioned Bedrock to me in passing the other day and now you! I really
   like it. Thanks for the tip. For anyone reading this thread, the URL above is
   missing an S: [https://roots.io/](https://roots.io/)
 * **RE: Mistake**
    I feel like it was a mistake to put my clients on a multisite
   installation because the sites have nothing to do with each other. So I end up
   with tons of plugins installed with only a few active on each site. In some cases,
   I have multiple plugins installed that do nearly the same thing in a slightly
   different way, or because that is what the client is used to and they don’t want
   to change. Also, when I am troubleshooting and the instructions say “disable 
   all plugins and restart them one at a time” I want to scream. The last, and maybe
   the biggest, is that moving them is harder with a multisite install. I just bought
   the pro version of Duplicator, so that has made it easier, but nothing will be
   as easy as wrapping the whole thing up in a Duplicator file and just dropping
   it wherever you want.
 * But, given that I’ve settled on that as my way to move things around, the one
   thing that would be great is if I could make my Duplicator packages but skip 
   the folders that are already on the server. I’ve actually considered doing that.
   Just omit the wp-admin and wp-includes folders and use file manager to copy/paste
   them from a central place on the server. When I thought of that, I wondered if
   maybe the files that are specific to a given site could just use the files in
   those folders from the central location. And here we are.
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [Finding a filter in 3rd party plugin](https://wordpress.org/support/topic/finding-a-filter-in-3rd-party-plugin/)
 *  Thread Starter [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/finding-a-filter-in-3rd-party-plugin/#post-8553286)
 * Hey Steve,
 * Thank you for for the reply. I searched the plugin files for “apply filters” 
   and didn’t get anything that looked right. So, applying the same principle, I
   searched again for the class name on the div that contains the image and found
   the file that creates the slides. Here’s the problem, there is no filter there.
   So, I started looking into how I modify the plugin. I’m going to add this for
   anyone reading this in the future: There is no equivalent to the child theme 
   idea for plugins.
 * So, I have been reading up on “forking” a plugin. This sounds a little intense
   for my skill level. I’m going to start by contacting the plugin author and ask
   if they would be willing/able to add some filters. I’ll post back if I press 
   on with the forking option.
 * Graham
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Caldera Forms - More Than Contact Forms] Caldera form is returning code after submission!](https://wordpress.org/support/topic/caldera-form-is-returning-code-after-submission/)
 *  [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [10 years ago](https://wordpress.org/support/topic/caldera-form-is-returning-code-after-submission/#post-7260409)
 * David,
 * I found this thread because I was having the same problem as the others. I didn’t
   notice that the plugin had an update available. So I updated and the form submits
   now. But, it doesn’t use AJAX. So went looking for a solution to that problem
   and found this post.
 * [https://calderawp.com/2016/01/caldera-forms-1-3-2-ajax/](https://calderawp.com/2016/01/caldera-forms-1-3-2-ajax/)
 * Which says:
 * > Because nothing is 100%, when using AJAX submissions, if the submission returns
   > a 404 error, Caldera Forms will try again, without using AJAX. This will cause
   > a page refresh, but it will work. This fallback shouldn’t be necessary, but
   > it is there, just in case.
 * What I can’t find is anything to help troubleshoot the “Why?” of the AJAX submission
   failure. I think it’s related to the issue above because I’m using a single page“
   Coming Soon” theme where the author may have left out something that would normally
   be included in a theme. I just can’t find it. Here is the theme:
 * [https://www.wpkube.com/launch-free-coming-soon-wordpress-theme/](https://www.wpkube.com/launch-free-coming-soon-wordpress-theme/)
 * Any ideas? I can probably solve this problem by working this up in twentyfifteen
   but I’d like to know what a page _must_ have in order for CF to work.
 * Thanks,
    Swani
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [I need to move main menu to right](https://wordpress.org/support/topic/i-need-to-move-main-menu-to-right/)
 *  [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/i-need-to-move-main-menu-to-right/#post-7198716)
 * Glad it worked. You did it right but if you want to make using CSS a little easier
   you might want to install a custom CSS plugin. They are super handy. Then you
   would just open the plugin and paste in your CSS for anything in the future. 
   Have fun!
 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Editing "Button" Theme](https://wordpress.org/support/topic/editing-button-theme/)
 *  [swani](https://wordpress.org/support/users/swani/)
 * (@swani)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/editing-button-theme/#post-7198704)
 * Hi,
 * The change you are trying to make will be made in the CSS (Cascading Style Sheet).
   There are many plugins that will let you do this. One called “Simple Custom CSS”
   is pretty easy to use. Install a CSS plugin and paste in this chunk of CSS.
 *     ```
       .main-navigation a:hover {
         color:red;
       }
       ```
   
 * Change “red” to whatever color you want the text to be when you hover the mouse
   over and you’re done. If you want to learn about more options you have when using
   CSS just Google “CSS tutorial” and you’ll find some good stuff.
 * Good luck.

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/users/swani/replies/page/2/?output_format=md)
[→](https://wordpress.org/support/users/swani/replies/page/2/?output_format=md)