Compare commits
6 Commits
46c4502cb4
...
7871d12193
| Author | SHA1 | Date | |
|---|---|---|---|
| 7871d12193 | |||
| f4b89fe9c9 | |||
| 65825221d5 | |||
| 7e6f5eef21 | |||
| e267493629 | |||
| 4a693f280a |
|
|
@ -6,12 +6,4 @@ require_once(__DIR__ . '/includes/post_types.php');
|
|||
require_once(__DIR__ . '/includes/columns.php');
|
||||
require_once(__DIR__ . '/includes/revue.php');
|
||||
require_once(__DIR__ . '/includes/auteurs.php');
|
||||
// require_once(__DIR__ . '/includes/taxonomy.php');
|
||||
// require_once(__DIR__ . '/includes/admin.php');
|
||||
// require_once(__DIR__ . '/includes/logos.php');
|
||||
// require_once(__DIR__ . '/includes/nawalker_fction.php');
|
||||
// require_once(__DIR__ . '/includes/utilities.php');
|
||||
|
||||
// require_once(__DIR__ . '/includes/widget.php');
|
||||
// require_once( __DIR__ . '/includes/errorlog.php');
|
||||
// require_once( __DIR__ . '/includes/logos.php');
|
||||
require_once(__DIR__ . '/includes/article.php');
|
||||
|
|
|
|||
57
includes/article.php
Normal file
57
includes/article.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
|
||||
function dynamiques_article_save_post($post_id)
|
||||
{
|
||||
$current_article_ID = $post_id;
|
||||
$post_type = get_post_type($post_id);
|
||||
if ($current_article_ID && $post_type !== 'articles') return;
|
||||
|
||||
$related_revue_ID = get_field('related_revue', $current_article_ID);
|
||||
|
||||
dynamiques_article_remove_articles_from_all_revues($current_article_ID);
|
||||
|
||||
if ($related_revue_ID && is_numeric($related_revue_ID) && $related_revue_ID !== '') {
|
||||
dynamiques_article_include_article_in_revue_articles_array($current_article_ID, $related_revue_ID);
|
||||
}
|
||||
}
|
||||
add_action('acf/save_post', 'dynamiques_article_save_post', 20);
|
||||
|
||||
|
||||
function dynamiques_article_include_article_in_revue_articles_array($current_article_ID, $related_revue_ID)
|
||||
{
|
||||
$current_article = get_post($current_article_ID);
|
||||
$related_revues_articles = get_field('articles', $related_revue_ID);
|
||||
if (!is_array($related_revues_articles)) {
|
||||
$related_revues_articles = [];
|
||||
}
|
||||
$related_revues_articles[] = $current_article;
|
||||
|
||||
|
||||
update_field('articles', $related_revues_articles, $related_revue_ID);
|
||||
}
|
||||
|
||||
|
||||
function dynamiques_article_remove_articles_from_all_revues($current_article_ID)
|
||||
{
|
||||
$revues_containing_article = new WP_Query(array(
|
||||
'post_type' => 'revues',
|
||||
'meta_query' => array(
|
||||
array(
|
||||
'key' => 'articles',
|
||||
'value' => '"' . $current_article_ID . '"',
|
||||
'compare' => 'LIKE',
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
foreach ($revues_containing_article->posts as $revue) {
|
||||
$revue_ID = $revue->ID;
|
||||
$revue_articles = get_field('articles', $revue_ID);
|
||||
|
||||
$revue_articles = array_filter($revue_articles, function ($article) use ($current_article_ID) {
|
||||
return (is_object($article) && isset($article->ID)) ? $article->ID != $current_article_ID : $article != $current_article_ID;
|
||||
});
|
||||
update_field('articles', $revue_articles, $revue_ID);
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
@import './components/post-card--revue.css';
|
||||
@import './components/post-card--article.css';
|
||||
@import './components/post-card.css';
|
||||
@import './components/etiquettes-grid.css';
|
||||
|
||||
/* ########### PAGES ############ */
|
||||
@import './pages/single-revues.css';
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
}
|
||||
}
|
||||
&:hover {
|
||||
@apply bg-primary text-white border-none;
|
||||
@apply bg-primary text-white;
|
||||
svg {
|
||||
transform: rotate(90deg);
|
||||
circle {
|
||||
|
|
|
|||
3
resources/css/components/etiquettes-grid.css
Normal file
3
resources/css/components/etiquettes-grid.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/* .etiquettes-grid {
|
||||
@apply flex flex-wrap gap-4;
|
||||
} */
|
||||
|
|
@ -60,7 +60,7 @@ $articles = get_field('articles', $current_issue->ID);
|
|||
|
||||
<article class="single-revue__articles">
|
||||
<h2 class="single-revue__articles__title article-title"> <?php echo get_the_title($article); ?></h2>
|
||||
<ul class="single-revue__articles__tags article-tags">
|
||||
<ul class="single-revue__articles__tags article-tags-list">
|
||||
<?php foreach ($terms as $term) : ?>
|
||||
<li class="single-revue__articles__tag article-tag"> <?php echo $term->name; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user