Parse error: syntax error, unexpected ‘endforeach’ (T_ENDFOREACH) in [closed]

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; ?> … Read more

pull 500 post of many from database [duplicate]

function posts_limits_set( $limit, $query ) { if ( ! is_admin() && $query->is_main_query() && $query->is_search() ) { return ‘LIMIT 0, 100’; } return $limit; } add_filter( ‘post_limits’, ‘posts_limits_set’, 10, 2 );

how to handle multiple forloop?

You can do something like this public function getStuffDone() { $order_ids = array( 358,368 ); $items = array(); // contains the names foreach ( $order_ids as $order_id ) { $order = wc_get_order( $order_id ); foreach ( $order->get_items() as $item_values ) { $items[ $order_id ][] = $item_values->get_name(); // add the name to the array } } … Read more

Problem with ms-thumb-frame-selected class in Master Slider

Seems you are simply overwriting #masterslider .ms-thumb-frame-selected with each loop. So in the end only the last iteration will take effect. You maybe need to add the post ID as class somewhere as well and then target #masterslider .ms-thumb-frame-selected .post-<?php echo $post->ID; ?> { } in your CSS. Adjust your markup inside The Loop to … Read more

For each loop will not append to the_content hook

Filter should modify the given value and return it. It should not print anything. But your foreach loop does exactly opposite – it prints its output and doesn’t append anything to result. So when you use it to append its result to the content, it prints its result and doesn’t return anything – so nothing … Read more

How to add custom HTML markup and classes to the_content()?

This sounds like something that should be handled in CSS without using classes, for examples article blockquote { background-color: #fff; } Instead of adding .bg-white to the HTML tag. If you really want to add custom classes you could use a filter or get_the_content() and parse it manually.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)