Hello,
I am using Oxygen builder and when I call the post type name it doesn’t show the “rewrite” slug, but the actual one.
I guess this is because Oxygen uses the standard get_post_type function from WordPress ) to get the post type.
I have tried then to use a function like this:
<?php
if(!function_exists('oxys_get_rewrite_slug')) {
function oxys_get_rewrite_slug() {
$post_type = get_post_type();
if($post_type) {
$post_type_object = get_post_type_object( $post_type );
$rewrite_slug = $post_type_object->rewrite['slug'];
echo $rewrite_slug;
}
}
}
?>but it doesn’t work and I am not a coder, so I am pretty blind here…
the Oxygen template allows inserting dynamic data using a “PHP function return value”, the option it has 2 fields where it asks for the function name and for the function arguments separated by comma.
First I have inserted the function as a code snippet,
the name is
oxys_get_rewrite_slug
but the arguments… ?
ChatGTP says there are none, it tried to give a me a bunch of alternatives but none of them works. So back to asking human beings 🙂
Thanks for any help
- This topic was modified 1 hour, 40 minutes ago by .
