Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. Wordpress shortcode prints wrong value from custom post type

Wordpress shortcode prints wrong value from custom post type

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
helpphpdesigndata-structurestutorial
1 Posts 1 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    moinmobility
    wrote on last edited by
    #1

    Hey guys, I run into a problem with developing a new project of mine, more specifically with a shortcode of mine. About the website setup: - I use wordpress - I use Elementors template option to print out a template on on all pages belonging to the taxonomy "Marken". - Custom post types are created with CPT UI and custom fields with ACF I got the following shortcode, to print out the specific brand on the site iteself:

    add_shortcode( 'MODELL', 'modell_shortcode' );
    function modell_shortcode() {
    $terms = get_the_terms( array(
    'post_type' => 'fahrzeuge',
    'taxonomy' => 'marken',
    'hide_empty' => false,
    ) );
    return ucwords($terms[1]->slug);
    }

    The code works fine put prints out the wrong brand. As you can see here Tesla – moinmobility.de[^] "Tesla" should be written in the text above but "Audi" is shown. The same issue applies for the other shortcodes there should be written "0 €" instead of "345 €" etc. Is this a problem with my shortcode? With Elementor? And how to fix this? Searched a lot on Google, Blogposts and Forums but couldn't find a helpful answear. Hope someone here can help me :)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups