samuelvincent
Forum Replies Created
-
I found a script on the site of another plugin that allows to do that : https://www.wp-eventmanager.com/documentation/changing-event-slugpermalink/
<?php function event_listing_post_type_link( $permalink, $post ) { // Abort if post is not a event if ( $post->post_type !== ‘event_listing’ )
return $permalink;// Abort early if the placeholder rewrite tag isn’t in the generated URL
if ( false === strpos( $permalink, ‘%’ ) )
return $permalink;// Get the custom taxonomy terms in use by this post
$terms = wp_get_post_terms( $post->ID, ‘event_listing_category’, array( ‘orderby’ => ‘parent’, ‘order’ => ‘ASC’ ) );if ( empty( $terms ) ) {
// If no terms are assigned to this post, use a string instead (can’t leave the placeholder there)
$event_listing_category = _x( ‘uncat’, ‘slug’ );
} else {
// Replace the placeholder rewrite tag with the first term’s slug
$first_term = array_shift( $terms );
$event_listing_category = $first_term->slug;
}$find = array(
‘%category%’
);$replace = array(
$event_listing_category
);$replace = array_map( ‘sanitize_title’, $replace );
$permalink = str_replace( $find, $replace, $permalink );
return $permalink;
}
add_filter( ‘post_type_link’, ‘event_listing_post_type_link’, 10, 2 );function change_event_listing_slug( $args ) {
$args[‘rewrite’][‘slug’] = ‘event/%category%’;
return $args;
}
add_filter( ‘register_post_type_event_listing’, ‘change_event_listing_slug’ );
?>someone would know enough to adapt to the first piece of script found?
I would like to copy the url pages of events on the tree of my site.
the main menu and the corresponding submenu will be automatically selected. currently I lose all my navigation when I return to the page of an event!
look thatI created categories in event manager using the same titles as the menus of my site, “hypnoresonance” and “hypnatal”.
I put a fixed slugs of the pages entitled “formations” corresponding to my submenus.
The hack found allows me to insert a variable in the slugs of the pages preferences: #_CATEGORYSLUG/formations
look thatthat change the url in the generated links, but the pages are not found.
if you look at this page https://lisebartfq.cluster026.hosting.ovh.net/hypnonatal/formations/ you will see that the url links to both events included the categories :
– https://lisebartfq.cluster026.hosting.ovh.net/hypnonatal/formations/formation-complete-hypnonatal/
https://lisebartfq.cluster026.hosting.ovh.net/<slug variable for categories>/<fixed slugs>/<event name>
I hope that the French / English translation is clear enough…
- This reply was modified 6 years, 6 months ago by samuelvincent.
je vais regarder tout cela, quitte a tout réinstaller histoire de voir ce qu’il se passe…
le formattate est issu d’un champs texte d’une base de données, et j’ai bien plusieurs fois mis a jour le champs directement depuis phpmyadmin pensant supprimer ce retour a la ligne.
je vous dirais si j’ai réussi a m’en sortir.
mille merci pour vos réponses en tout cas !
bonjour !
merci pour votre réponse, en Fran?ais qui plus est.
malheureusement aucun br ne traine, ni dans l’interface d’admin, ni planqué quelque part dans la base de données pour dans le code php…
il doit y avoir une fonction de concaténation qui insère ce br mais j’arrive pas a la trouver.
j’ai mis les bouts de code de l’interface d’admin :
<i class=”fi-folder”></i> #_CATEGORIESj’ai remplacé l’espace blanc avant #_CATEGORIES par un retrait en css mais rien a faire ! j’ai toujours se satané br !!!