To insert new code you need to break php code and past your new html+/-php code. But pay attention that after passing all will have correct syntax.
Your question should be made like this:
<?php $my_query = new WP_Query( "cat=11&posts_per_page=1" );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post(); ?>
<h2><a href="https://wordpress.stackexchange.com/questions/53008/<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="postdetails">
Written by <strong><?php the_author(); ?></strong>
<?php the_time ('j F, Y'); ?>
Posted in: <strong><?php the_category(', '); ?></strong>
<?php the_tags(); ?>
</div>
<?php the_excerpt();
}
}
wp_reset_postdata(); ?>
Related Posts:
- Limit the Excerpt field in WP-Admin in words
- Multiple choice in a custom taxonomy
- Error when adding excerpt to the content through functions.php
- Using $wpdb (WPDB class) ‘replace’ with multiple WHERE criteria problem
- List of Events with Multiple Dates: Only NEXT Date
- Assign Custom classes to every Excerpt
- How can I check that the acf field value is not a duplicate when adding a post?
- Trying to modify content.php
- Show content by using tags
- Check if values exists DB
- Accessing the database from a plugin outside of action hooks
- How do I Add HTML to the_excerpt() & the_content() Output?
- Echo a hierarchical list of post data from custom fields
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Accessing data from a non-WP database/table within a page content
- Create WP_Query to search for posts by their categories or their parent/child categories
- WP Query with custom Shortcode
- WordPress blog post url on category page
- Storing Array from returned database query and using the array in a new query
- Changing layout with wp_customise
- WP dynamic featured image – Can’t get second featured image url
- Converting HTML Template to WordPress Theme
- Extending the WP_Widget_Text class
- mysql query from wordpress page using custom table
- Selectbox in admin panel function linking to CSS
- Mass update excerpt
- WordPress 3.2 query_posts and pagination, permalinks issue
- Can I install/embed WordPress on a ‘single page’?
- only show container with next/prev links if they exist?
- How to put “Read more” link in Custom Excerpt inside p tag?
- What query string parameter is available for index.php, that works for both pages and blog articles?
- ACF: how do I get the fields and its values of a specific group?
- How to check if a meta value has already been assigned to any user?
- How to hide products that do not have an image from a slider carousel for an ecommerce webpage?
- Customize Theme comment template to Insert VoteUp and VoteDown buttons
- filter default query to show just selected level of child pages in wordpress
- Retrieve $_POST data submitted from external URL in WordPress(NOT API)
- Dynamic content based on a URL parameter
- Set WP_query ‘order’ option by another tables value
- Trying to build simple deposit code that hooks into woocommerce
- How to pick the default selected value in wordpress dropdown?
- WordPress default Search function inconsistent in WooCommerce Product Titles
- Add New User, extra fields which are required?
- user_profile_update_errors hook not executing
- Send an email to specific adress when button is clicked?
- Customizer: active_callback and sanitize_callback incompatibility?
- Saving and Restoring a Canvas on A Individual User Basis
- Redirect specific user role to specific site after login?
- Send multiple attachments with wp_mail in PHP
- WordPress admin pointers tour bug?
- Increase offset while looping
- custom url rewrite for wordpress
- Extend plugin Class through functions.php
- Long running queries
- wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
- How to add a do_action on refreshing of WP customizer?
- Function to delete a post, it’s children and it’s grand children (half way there already)
- Customize position of social icons in upme plugin [closed]
- How to pre populate a form field with a link of a current user’s author profile?
- Weird 404 URL Problem – domain name being placed at end of urls
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Trying to get a PHP variable defined in a custom post into a javascript file. Null value. Using wp_localize_script
- How to get the value of input hidden html from text editor to custom page template?
- HTML tags not showing in excerpt
- Make a list of sites for each user in WPMU – switch_to_blog (display in SITE_ID: 1)
- Menu jumping when calling it via PHP
- Output Video Download Link in template
- Modify custom field input data before creating a new post
- Output custom field value to post string
- Query if audio attachment AND/OR custom field
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Media Upload , file name changed automatically
- Replace shortcode in substring
- Custom posts in different columns style
- Query Pages and post excerpts dynamically
- Need help enqueueing webfonts
- need help with existing code showing subpages
- register_taxonomy() take much queries
- How do I add a custom css to all posts without affecting homepage css? [closed]
- WordPress SQL injection
- How do I find PHP file that contains content of my page?
- My custom get_the_excerpt() can’t get excerpt by ID
- how to show only specific category for a template
- Which is the correct way to conditionally enqueue a CSS file?
- Custom Background by Page IDs
- WordPress page content outside WordPress
- Adding Meta Tags to a Post using its Tags, Excerpt and content
- Using the_excerpt() on a page
- Odd / Even posts add class minus first post
- Advanced Custom Fields not displaying
- How to get private property in parent class into extended class?
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- “operation successful” message
- unable to use ‘new WP_Query’ in AJAX call
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- Exclude posts with specific metadata from search?
- Change order of custom submenu link in WP Admin?
- Underscore – Self hosted fonts
- Parse error: syntax error, unexpected ‘}’ on get_the_author_meta [closed]