The options are being output within the loop, so are being repeated for each iteration of the loop.
To check within the loop and only output something on the first iteration:
while ( have_posts() ) : the_post();
if( $wp_query->current_post == 0 ):
// this is the first post
// output your options
endif;
// other loop stuff, title, content, etc.
endwhile;
similarly, to check if you are on the last post of the loop:
while ( have_posts() ) : the_post();
if( $wp_query->current_post == ( $wp_query->post_count - 1 ) ):
// this is the last post
endif;
endwhile;
Related Posts:
- Fatal error: Call to undefined function mysql_connect()
- Deprecated: mysql_connect()
- How to Remove all Instances of edit_post_link
- is it possible to run some php code within a wordpress page?
- Query both first_name and last_name from wp_usermeta at the same time
- How to use update and delete query in wordpress
- How to implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- reason of splitting theme files to multiple files
- How to add query vars with paginated URLs?
- How to Join two tables from separate databases within WordPress
- Site Title and Tagline in Pagelines DMS Options Panel
- simple wordpress ajax plugin not working when not logged in
- MySQL query performed 4 times inside loop
- Show only one post for each author ( Page loads too slow )
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- Install will not load: PHP does not have MYSQL installed
- Insert post without actions/hooks
- Import 10,000 Users into WordPress WITH a specific ID for each user
- Modern Tribe Calendar wp-query with meta query not working at all
- WP database error for comments_popup_link()
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- How to get the post_id from postmeta
- Styling images coming from another blog
- register_activation_hook isn’t adding table to DB
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Query String being Removed Creating a Pagination Issue within a Custom Plugin
- How to convert objects into arrays
- Ajax $wpdb not returning table data
- Converting MYSQL to WordPress $WPDB
- Is there a way to get 3+ dimensional array from a single MySql command
- Custom Plugin For Converting CSV To MySQL
- Set WordPress Default Template
- Checking for new message using AJAX and PHP. Server overload?
- Can’t get wp_insert_post to work
- I want to select the from values from database in WordPress? [closed]
- mysql query from wordpress page using custom table
- Importing Geo data into wordpress database
- PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
- How to check if a meta value has already been assigned to any user?
- WP Post-Thumbnail
- wp query foreach deleting record returning only first or last item
- inserting a post from an extern php file but post content doesn’t show on wp site
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- $wpdb->wp_users returning empty value for
- WordPress Options Page Theory Question
- Make a database query using WordPress
- Link blogname and blogdescription to the Options Framework
- Force Users To Relogin
- Basic wpdb update question
- A $_POST should occur when submit form but is not?
- Pull MySQL data from multiple tables and merge into 1 PHP array
- Using CFDB7 vs Custom MySQL Database [closed]
- How can I Use 2 databases with one WordPress install
- Using wordpress function to retrieve data
- form $_post action value gets truncated after it passes through two forms
- Adding data to custom wordpress database table
- Deactivate a plugin on wp version
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- making php value numeric
- populate select options from extra mysql table data
- Removal of all posts content in bulk, keeping the posts itself
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- How to store checkbox data for individual users?
- Illegal string offset in PHP function in via Theme Customizer
- Please help! I have a problem with getting wordpress databas
- How to run complex query using PHP
- call to undefined function mysql_connect
- Usermeta data unserialize, extract and display in table in WordPress
- Conditional formatting on data fetched from MYSQL
- Can I split a huge wp_postmeta table across different databases or servers?
- I can’t separate the array by commas
- WordPress mysql deos not work with php7
- How can i limit the number of posts to the most recent 6 in my query?
- Error inserting into custom table – Object of class wpdb could not be converted to string [closed]
- WP + MySql db / PHP
- The plugin generated 225 characters of unexpected output during activation
- append data to mysql table via submit button coded in php – not working
- WordPress select query issue
- (Who to follow) Twitter widget
- How to do a MySql query in WordPress?
- Add two or multiple functions in WordPress Post or Page
- How can I display a query in a page?
- Send data from plugin to external database
- How to properly send many mysql queries via php and what happens with ajax requests after they are sent?
- How to set max users to 17.000
- Passed variable gets undefined variable error on insert on next page
- directorypress theme error mysql_error() [closed]
- How to set up an auto delete post?
- wp_customize_image_control default value
- WordPress Setting page can not be saved by html radio
- Cannot Upload Custom Header Image into WordPress Dashboard
- MySQL update text field with ‘
- Options.php loop won’t show!
- Predefine Magazine Style Layouts
- Parse error: syntax error, unexpected ‘}’ in C:\xampp\htdocs\admin\products.php on line 148 [closed]
- How to set variable to specific field when querying
- How to get a database field value from a WordPress table? [closed]
- Error resetting database index using ALTER TABLE in $wpdb->query
- How to return count number from a wordpress database