try this:
<ul id="post-list">
<?php
global $post,$wp_query;
$current_id = $wp_query->get_queried_object_id();
$args = array( 'numberposts' => 7 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<li<?php if ($current_id == $post->ID) echo ' class="current"'; ?>>
<a href="https://wordpress.stackexchange.com/questions/26841/<?php the_permalink(); ?>"><?php the_title(); ?><br /><span><?php the_author(); ?></span></a>
</li>
<?php endforeach; ?>
</ul>
Related Posts:
- Not able to change wp_title using add_filter
- How to hook a filter to catch get_post_meta when alternate a custom field output?
- Changing JPEG compression depending on image size
- How to add headers to outgoing email?
- LESS CSS enqueue_style with add_filter to change rel attribute
- Remove Editor From Homepage
- Advanced Custom Fields and Yoast SEO keyword analysis [closed]
- Insert Custom HTML After Shortcode
- Is there a way to add another row to the tinyMCE kitchen sink toggle?
- Remove description from on Home
- add_filter to youtube embeds?
- How can I detect if a user changes their password?
- SSL certificate for the host could not be verified
- Store source permalink on XMLRPC calls
- How to limit the pages displayed for choosing parent page on page attribute’s menu?
- Moving sharedaddy buttons (in Jetpack) to the top of a post?
- How can I customize the wp_list_categories
- WordPress RSS feed – filter RSS content by custom field value
- How apply_filters work in WordPress?
- Apply a filter only once
- What functions are included in apply_filter(‘the_content’)
- Filtering admin entries for custom post type
- Anonymous function is executed twice in wp_head while added from the_posts filter?
- Add a header before fields added with the attachment_fields_to_edit() filter
- Are there Limitations on filter handles?
- Hide content editor for posts after approriate date
- Buddypress: Edit activity when new blog post [closed]
- How to make a button?
- How do I filter title and alt attributes in the gallery shortcode?
- Same Conditionals Not Working on Two Different Hooks
- Filter get_template_part() $args array
- Modify a Filters Second Parameter
- Variables in post title
- How to edit dashboard search posts button texts for my CPT?
- Insert term when page is published – avoid duplicates after edits
- Filter Media by Featured on Admin
- When does a function assigned to the content_filtered_edit_pre filter hook fire?
- Capture post content before page renders
- Empty string supplied as input when parsing content
- How can I remove the kses filters when saving a specific post type ? (it breaks my JSON)
- Remove_action does not work
- page_attributes_dropdown_pages_args filter does not work
- How to access plugin variables from theme templates without using globals?
- Make an array filterable per hook
- How to pass variables to custom filter from multiple functions
- WooCommerce Custom Product Validation [closed]
- Make WP not format code, not insert line breaks in between tags
- add img class to native wordpress galleries
- Get Posts updated or published within the last x hours
- the_content filter together with require_once returns 1 instead of the content of the included file
- Missing Argument 2 for apply_filter
- How to get a single hook from wp_head()?
- WP filter to alter admin CSS styles?
- preview_post_link for Custom Post Types
- Filter an array with a callback – for single & multidimensional arrays
- How to apply a filter to an ACF wysiwig editor field output?
- Why this filter hook is not working when passing parameters?
- Are href attributes of a elements filtered on output to add the current path?
- Is it possible to bind a function to a filter hook via Ajax?
- Change the template when the user is not logged in using page_template filter (it does not work)
- Regarding post text filtering
- Add Filter not working with get_posts
- How to Prevent WordPress to encode html in post?
- Filter Pages by Custom Field (ACF) in admin area
- Filter posts by meta data using custom query
- Most performant/functional way to add actions/filters?
- Remove tags without a specific meta key from “choose from the most used tags”
- Which Filter Do I Use To Modify The Subject Of The Retrieve Password Notification Email?
- Register users by e-mail
- automatic title through filter
- Filter causing loss of _wp_attachment_metadata
- Action hook to control access to certain parts of my site
- Buddypress Filter Multiple Activities [closed]
- How can I tranlslate post date in italian?
- Use alternative front page if cookie is set
- Having wp-admin on different domain
- Use a functions in functions.php to remove a string for template theme
- how to output HTML tags in post_content and not as plain text
- oembed_dataparse filter not running at all for standard YouTube embed
- Security question – Display a General Custom Login Error Message
- Action for opening attachment or manipulating all attachment links
- Filter wp_mail based on content type
- Add filter conditionally to a page
- Remove the post_content search from WHERE clause (and CONCAT sql function)
- mu-plugins body_class filter not working
- How to apply a filter to everything?
- shortcode function outputs multiple anchor tags
- WP Dashboard -> Posts-> Filter by Category -> Form Method Change : Which Hook
- Show child theme for users on specific IP
- Remove action added from class
- wp.getPosts with status = ‘trash’ using node.js
- Is there a way to overwrite a filter used in canonical.php?
- Adding an orderby filter, casting postmeta with multiple keys
- Identify admin/logout and more filters
- Sanitizing a custom query’s clauses
- How can I display wp_link_pages before a shortcode, if it is used, or display after content?
- post->post_content filter
- How to create a list of terms who’s posts also have a predefined external term?
- How to change this WP logo and posts url in block editor?
- Limit total tags in the_content