How about using a standard for
loop instead:
$sunnytags = get_tags ($tagargs);
$count = count ($sunnytags);
for ($i = 0; $i < ($count < 15 ? $count : 15); $i++) {
$string .= '<a class="tag2" href="'. get_tag_link ($sunnytags[$i]->term_id) .'">'. $sunnytags[$i]->name . '</a>';
}
And then later, whether you re-run the query or (better still) save $sunnytags
for later use, you can get the rest of the elements like this:
for ($i = 15; $i < $count; $i++) {
// Process the rest of them here as $sunnytags[$i]
}
Related Posts:
- Alter required message using comment form api
- Warning: in_array() null given in PHP function
- Display a post based on its metabox selection
- How to make a image-size selected by default in Media upload – WP v3.5
- Apply class to every paragraph that holds image?
- static variable loop not working in WordPress
- adding a filter to a shortcode?
- Set media upload attachment link to none and hide it in WP v3.5
- How to automatically apply woocommerce product title to all product images alt tags?
- How to store the_title() into a variable to reutrn the value, not just echo it
- Change the footer text on the login page
- add_filter to post-gallery and remove all ‘s?
- How to overwrite youtube embed?
- Rewriting search and pagination base
- Check if page parent has certain template
- Change comments form title on a page by page basis
- Remove class that has been added by parent theme
- show limited tags in an article
- display most popular tags in two columns
- How do I know what variables are passed in a filter/action and what their meaning is?
- Need to get specific data from array
- Why do filters/actions require an argument count?
- Create an array from an array
- Check if term object is in array
- Highlight Current Tag in wp_tag_cloud
- Must Use Plugin Causing Query Error
- How to use return in my custom function instead of echo
- Run a filter when a walker runs
- Handling Body class based on Template
- Get_avatar filter?
- Way to querry data (tags) from a wordpress database?
- Add a class to the anchor tag on HTML5 gallery
- How to properly loop through these external URLs to get them into the sitemap using this hook
- add_action shortcut?
- get a simple array of all of the term names that exist in all taxonomies
- Populate dropdown with Child Pages based on Parent Page chosen
- How can I remove a function that has been added to wordpress with add_filter?
- How to control WordPress image metadata (using Imagick)?
- How do I add custom bulk actions to multiple custom post types?
- Add data attribute to each li in menu
- Removing “wpautop” (auto tags) only on certain pages?
- WordPress Gravatar filter is removing my custom attributes
- foreach loop still echoes array
- Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
- Unique icons next to each WordPress menu item
- Redirect to another page using contact form 7? [closed]
- Add item to top of menu using a filter in functions.php
- meaning of (array)function()
- Override a function defined in wp-includes/comment-template.php
- Edit the_category (); for a hierarchical display
- Need to put a script above tag in header.php – WP 5.7.1
- wp_force_remove_style’ not found
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- Deleting Certain terms from appearing on the front end as links
- Content filter won’t work
- Upload multiple files in randomly generated folder using wp_upload_bits
- Create page template via functions.php?
- Add meta tags to a custom header
- Loop over Array and get the distinct ids
- If Array Values Match Another Array’s Values, Then
- How to have different site identity logos on each page on Astra Theme [closed]
- Custom query vars filters problem with pagination
- Filter by field with array value in ACF on WP REST API
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- Dynamically adding filters
- Must filter functions receive all arguments passed to them?
- Only load certain artists on this page
- User filter posts by year
- Apply function.php filter only if url not has /amp/
- Multiple Tag Filtering
- How to bind each “the_content” elements to a custom variables
- Reload page with a different shortcode when a user selects from a dropdown
- WordPress Ajax filter: Create two loops for different output styles?
- How to filter specific element of an array in wordpress/php?
- Custom Bulk Actions handler not firing
- Store custom field’s multiple values in one user meta key
- How to generate customized filtered output for the gallery
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Display posts using post ID’s in an array
- Using Tag Groups: Displaying groups and adjacent tags of current post
- Notify admin (by email) if post added with specific tag
- Woocommerce Price Text
- Limit Taxonomy Parents
- Insert wordpress tags below posts via functions.php
- WordPress – show all posts + ones with specific tag
- Search box background on a different page template
- Display a list of users with avatar filterable with alphabets
- Showing all post from all post type in admin backstage
- AJAX: WordPress filters inside $html do not work as intended
- Change background image based on tags
- how to loop through blog posts in php
- Assign new post author IF another user in custom field on post transition
- The search doesn’t work properly
- Add attribute to featured image with filter (wp_get_attachment_image_attributes)
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- How to add different menu items on different menus?
- Replace block content with an array
- How to pass value to add_filter wpcf7_form_tag from another function?
- Add text below WooCommerce short description if metabox value is true