Sliders met css met pijlen

echo "<link rel='stylesheet' href='";
bloginfo('template_directory');
echo "/diascss.css' media='screen' />";
echo "<section class='mt mt_m br br_l'>";

	echo "<div class='cssslider-container'>";
		echo "<div class='cssslider'>";

			$i = 1;
			$args = array ( 'posts_per_page' => -1, 'cat' => 5, 'orderby' => 'title', 'order' => 'ASC' );
			$myposts = get_posts( $args );
			
			$number = count($myposts);

			echo "<div class='cssslides'>";

			foreach( $myposts as $post ) :	setup_postdata($post);

			echo "<div id='slides__" . $i . "' class='cssslide'>";
			echo "<span class='cssslide__text'>";
			the_title();
			echo " " . $i . "</span>";
			echo "<a class='fa fas cssslide__prev' href='#slides__";
			if ($i == 1)
			{
				$dianr = $number;
			}
			else
			{
				$dianr = $i - 1;
			}
			echo $dianr . "' title='";
			if ($i == 1)
			{
				echo "Laatste";
			}
			else
			{
				echo "Vorige";
			}
			echo "'></a>";
			echo "<a class='fa fas cssslide__next' href='#slides__";
			if ($i == $number)
			{
				$dianr = "1";
			}
			else
			{
				$dianr = $i + 1;
			}
			echo $dianr . "' title='";
			if ($i == $number)
			{
				echo "Eerste";
			}
			else
			{
				echo "Volgende";
			}
			echo "'></a>";
			echo "</div>";

			$i++;							  
			endforeach; 

			echo "</div>";

			echo "<nav>";

			$i = 1;					
			foreach( $myposts as $post ) :	setup_postdata($post);
			echo "<a href='#slides__";
			echo $i;
			echo "'></a>";
			$i++;							  
			endforeach; 
			echo "</nav>";

		echo "</div>";
	echo "</div>";	

echo "</section>";