I have a loop that gets all the posts that are "custom_post". It works perfectly - apart from that when I echo a variable it duplicates the variable when there are more than one post.
Its hard to explain - but basically if I have one post it works perfectly. I get a Div with the class name that is assigned to that custom post.
When I add another post - again that works, but displays two divs with the second post. I would imagine that it has something to do with echo $variable in the loop.
Any ideas? Thanks
EDIT
CODE:
function display_css() {
$ids = array();
$args = array( 'post_type' => 'custom_post');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
array_push( $ids, get_the_ID() );
endwhile;
foreach (array_unique($ids) as $key => $value) {
$check_select_modules = $titan->getOption( 'selec_modules', $value );
if ( "accordianmodule" == $check_select_modules) {
include(DE_DB_PATH . '/lib/modules/accordian.php');
}
elseif ( "textmodule" == $check_select_modules) {
include(DE_DB_PATH . '/lib/modules/text.php');
}
else {
}
}
}
add_action( 'wp_head', 'display_css', 15 );
Then in one of the php scripts it has
$css_accordian .= '<style id="css-'.$accordian_module_heading_css_class_display.'">';
echo $css_accordian;
I get the variable $accordian_module...... further up the script.
.=meansappend