59 lines
2.4 KiB
PHP
59 lines
2.4 KiB
PHP
<!DOCTYPE html>
|
|
<html <?php language_attributes(); ?>>
|
|
|
|
<head>
|
|
<meta charset="<?php bloginfo('charset'); ?>">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>MxDev</title>
|
|
<?php wp_head(); // Crucial: Allows plugins to add scripts and styles ?>
|
|
</head>
|
|
|
|
<body <?php body_class(); ?>>
|
|
|
|
<?php get_header(); ?>
|
|
|
|
<main>
|
|
<?php if (have_posts()): ?>
|
|
<?php while (have_posts()):
|
|
the_post(); ?>
|
|
<article>
|
|
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> (<?php the_date(); ?>)
|
|
(<?php the_author(); ?>)</h2>
|
|
<br>
|
|
<?php if (in_category('dev')): ?>
|
|
<h3><?php echo 'Projet : ' . get_field('projet'); ?></h3>
|
|
<h4><?php echo 'Language : ' . get_field('language'); ?></h4>
|
|
<?php
|
|
// Format the sources text. Set it as "Privé" if there is no http in the field value.
|
|
$source = '';
|
|
|
|
$proSources = get_field('sources');
|
|
if (!str_contains($proSources, "http")) {
|
|
$source = 'Sources : Privé';
|
|
} else {
|
|
if (str_contains($proSources, "mxgit")) {
|
|
$source = 'Sources : <a href="' . get_field('sources') . '" target="_blank">MxGit</a>';
|
|
}
|
|
if (str_contains($proSources, "github")) {
|
|
$source = 'Sources : <a href="' . get_field('sources') . '" target="_blank">GitHub</a>';
|
|
}
|
|
}
|
|
|
|
?>
|
|
<h4><?php echo $source; ?></h4>
|
|
<?php endif; ?>
|
|
<div>
|
|
<?php the_content(); ?>
|
|
</div>
|
|
<h3>Catégorie(s)</h3> <h4><?php the_category( $separator, $parents, $post_id ); ?></h4> <h3><?php comments_number('0 Commentaire', '1 Commentaire', '% Commentaires'); ?></h3>
|
|
</article>
|
|
<?php endwhile; ?>
|
|
<?php else: ?>
|
|
<p>Sorry, no posts matched your criteria.</p>
|
|
<?php endif; ?>
|
|
</main>
|
|
|
|
<?php get_footer('layout', 'footer'); ?>
|
|
</body>
|
|
|
|
</html>
|