When you use endforeach;
, you have to use :
instead off {
when starting the foreach
.
<ul class="project-extension-side-link">
<?php foreach($projectextensions as $projectextension) : // <--- ?>
<li <?php echo ($section=='project-extension' ? 'class="active"': ''); ?>><span>Project 1</span></li>
<li><a href=""><?php echo $projectextension->post_title; ?></a></li>
<li><a href="">Project 3</a></li>
<li><a href="">Project 4</a></li>
<li><a href="">Project 5</a></li>
<li><a href="">Project 6</a></li>
<?php endforeach; ?>
</ul>
Greetz Bjorn
Related Posts:
- Show modified time if post is actually modified
- AJAX handler throws 400 (Bad request) – why?
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Most elegant way to enqueue scripts in function.php with foreach loop
- WordPress – thumbnail image from youtube (function and loop)
- Adding WooCommerce to a Custom Theme – not working [closed]
- A snippet after every image
- Function to show only first instance of shortcode
- Automatically insert php function into post $the_content
- Creating loop within functions.php
- Display WooCommerce subscriptions for user [closed]
- How to use max and min values of custom fields
- Custom Shortcode, functions PHP WP_Query loop
- Filtering posts by category name based on page’s slug
- 2 Loops, Only Displaying 1 Loop in Both Loops
- Having a Function Inside of the Loop
- Getting different functions data while using while loop in wordpress
- Create a new query in function.php to filter blog posts
- Limit length of first excerpt in the loop
- Default Custom Field Value Automatically Update
- Multiple Loops Meta Data
- Why doesn’t is_page(id) work in functions.php?
- The Loop not looping?
- While loop with an exception after a count is reached
- How do I pull excerpts from pages?
- Output loop to function return?
- issue with if/elseif in_array inside foreach loop display only one post
- Genesis Framework: How to exclude a specific author from archive custom loop
- Problem with calling custom function in a foreach loop
- Get term slug by term id and then explode it
- Using functions.php to include code that’s processed inline
- Breaking up multiple words and inserting an image after first word
- Simplest Way to Build Custom Archives Page?
- Woocommerce Variable Product Dropdown for Custom Shop Template
- the_date() and the_time() functions display actual date an time instead of published date and time
- How set a while with a function
- Pass post ID from archive template to functions file
- Prevent function from triggering on current page
- How to use `foreach()` in ajax call
- Code executes outside of Loop while same code gives ‘Uninitialized string offset’ notice inside a while loop
- Only seems to be displaying one child when there are supposed to be multiple
- Integrate WP Tiles into existing loop (index.php) and theme
- Check if excerpt is empty at loop-portfolio
- Function to get the name in database table from the comma separated string
- Way of getting queried loop before the query with a filter hook?
- Post variables not displaying correctly in custom function
- Why don’t some template tags work when querying information on single.php?
- how to handle multiple forloop?
- How do grab the main loop, with conditions, and output via shortcodes
- Creating mixture of shortcodes to use in the visual/text editor
- Get full slug for a WordPress Post
- Update post meta with wp cron
- get php variable from functions php and echo it in theme template files [closed]
- WordPress function like is_category for subcategory? is_subcategory?
- Using a private method as an action callback from within a class
- Auto close (hide) custom metabox / set default state
- Does WordPress Development Mode Exist (with not minified JS)?
- WP_Query in functions.php
- wp_delete_user with username
- what is the meaning of settings_fields()
- Organize functions.php
- How to activate “Description” metabox for menu item programmatically?
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- Edit the_content function
- write in functions.php
- How to set child post categories to parent post categories when updating parent post?
- get excerpt without images
- Advice: Template structure – php blocks in sidebar or someting else?
- Help to resolve Syntax error, unexpected ‘endwhile’ (T_ENDWHILE) [closed]
- Removing the first image in content
- Make menu structure match page heirarchy on page parent change
- Global functions on WPMU
- is_account_page() change to page slug
- Help with WP gallery function, wrap gallery in div
- set_post_thumbnail when user is not logged in
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Overwriting the menu break points of twentysixteen in child theme
- Is there a WP function to get taxonomy name from taxonomy_term_id?
- Passing User_Fields to Contact form 7 [duplicate]
- How can this crude function be improved?
- Help With Creating Shortcode
- How to hide image-url if no attachment?
- How to properly refresh page after form action?
- WordPress Website with Login system
- Add a custom function to widget code
- Create Custom URL structure for specific Post category using Post ID instead of post name
- Exclude specific post from query
- wp_set_object_term via js btn frontend
- How can I show a specific page to admins only?
- Hide author info in single posts by certain users
- Creating a custom functions page wordpress
- WordPress Toggle Menu has stopped working
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- Surrond h1 entry-title automatically with a span tag
- Problem with custom WP_Query and underlying pagination/posts_per_page
- update_post_meta not working in function
- Show the post date using the wp_get_archives() function?
- How do I add functionality to images?
- Display function from functions.php in tag.php