WordPress shortcode not working

New Page

WordPress add-in shortcode not working

Pregunta

Pregunto Hace 8 years old

Edited 1 month ago

Visto 61k times

Esta pregunta muestra el esfuerzo de investigación; it is useful and clear

9

Esta pregunta no muestra ningún esfuerzo de investigación; no está claro o no es util

2

Brand is pregunta.

Mostrar actividad en esta publication.

Tengo a defined shortcode and add-on as follows:

// [tag1] -> A longer text function shortcode_example1() { return ‘A longer text’; } add_shortcode(‘tag1’, ‘shortcode_example1’);

Ahora, dentro de una página de wordpress, estoy tratando de acceder al complemento de la following manera:

[tag1]

Without embargo, the shortcode is not executed and the result is simply “[tag1]”. ¿Puede usted ayudar?

Thanks for your help.

  • Código corto

Cuota

Compare un enlace a esta pregunta

Copy link CC BY-SA 3.0

Mejora esta pregunta

Seguir

Sigue esta pregunta para recibir notifications

announced on September 5, 2014 at 7:45 p.m.

dhundupothu user avatar

Dhundupothu Dhundupothu

113 1 1 gold badge 1 1 silver badge 3 3 bronze badges

2

  • Your code works for me on WP 3.9.2, either in a plugin or in functions.php. Are the other shortcodes working correctly?

    –Gabriel

    Sep 5, 2014 @ 11:29 PM

  • 1

    I also confirm that this shortcode works fine. Did something remove the do_shortcode filter from the_content hook? Try switching to a default theme (does your theme use the_content()?) and disabling all plugins. Then activate them 1 by 1 to find the potential conflict.

    – helgatheviking

    Sep 6, 2014 @ 8:27 PM

Add a comment | 

4 answers4

Ordenado por: Restablecer a predeterminado

Puntaje más alto (predeterminado) Fecha de modificación (más reciente primero) Fecha de creación (el más antiguo primero)

This answer is useful

33

This answer is not useful

Show activity on this post.

Hay un par de cosas para comprobar aquí

  • Uno: ¿Está activado su complemento?

  • Dos: ¿Está su código abreviado en su archivo de complemento principal? Si ese código está en otro archivo dentro de su complemento, ¿se aseguró de incluir ese archivo adicional en su archivo de complemento principal?

  • Tres: ¿No tiene ningún tipo de error en su archivo de complemento que desactive su complemento después de la activación? ¿Ha configurado la depuración en verdadero? Uno de los miembros del sitio tiene un excelente complemento de depuración disponible para descargar en wordpress.org llamado Debug Objects .

  • Cuatro : Intente mover su código abreviado a functions.php de su theme para asegurarse de que su código abreviado realmente isé funcionando. Si no funciona dentro de su tema, el problema podría estar en su propio tema.

  • Cinco: como sugirió @helgatheviking, ¿no está filtrando the_content() de ninguna manera que pueda causar este comportamiento ?

  • Seis : si todo lo falla antérieure, désactive todos los complementos, cambie a un tema incluido y vuelva a verificar. Si le problème persiste, actualise/réinstalle WordPress, il y a quelque chose qui a été traité par un archivo central dañado.

Partager

Partager un lien vers cette réponse

Copier le lien CC BY-SA 3.0

Mejora esta respuesta

Séguir

Sigue esta respuesta para recibir notificaciones

répondu le 7 septembre 2014 à 8:36

Avatar of Pieter Goosen

Pieter GoosenPieter Goosen

53.8k 22 22 gold badges 109 109 silver badges 200 200 bronze badges

4

  • I did the checklist: 1=check!, 2=yes!, 3=nope, 4=ok, 5=nope, 6-> worked! After switching my local wp (for testing) from ‘Sydney Theme’ to ‘Twenty Fourteen’ the SC gets shown. Seems that there are themes which prevent SCs from showing in posts.

    – Martin Pfeffer

    Mar 13, 2017 at 3:02 am

  • Thanks Pieter for this checklist. Turns out I hadn’t included my file correctly…woops. Work fine now 🙂

    – Self Designs

    May 15, 2018 at 10:55 am

  • I did all the following and still it does not work. I have new WordPress (5.0.2) install with code added to functions.php file. But when i put [shortcodename] in a page it is treated as text. What is wrong? I use default theme: Twenty Sixteen.

    – hal

    Jan 4, 2019 at 1:08 pm

  • 1

    This is a super useful checklist. The only thing I’d add would be a seven: make sure your page editor isn’t using your shortcode like mine: This “helpful” WordBreak has been bugging me for a while. Thank you page editor…

    –Brian Stinar

    November 8, 2019 at 7:46 am

Add a comment | 

This answer is helpful

0

This answer is not helpful

View activity on this post.

Yo tuve el mismo problema:

result that faltaba me

<?php

in the upper part of the archive.

Hope that esto ayude.

To share

Share a link to this answer

Copy link CC BY-SA 4.0

Mejora esta respuesta

Seguir

Sigue esta respuesta para recibir notifications

answered on August 12 at 4:33 PM

quixote user avatar

Quixote Don Quixote

9 2 2 bronze badges

Add a comment | 

This answer is helpful

-1

This answer is not helpful

View activity on this post.

Agrega esto

add_filter(‘the_content’, ‘do_shortcode’);

To share

Share a link to this answer

Copy link CC BY-SA 4.0

Mejora esta respuesta

Seguir

Sigue esta respuesta para recibir notifications

answered on October 22, 2018 at 12:48

alegut user avatar

alegut alegut

11

1

  • 1

    Why? What does it do? Where would they add that? Please edit your answer using the edit link above and add more information on how this helps resolve the issue.

    – Hi_McGee ♦

    October 22, 2018 at 2:22 PM

Add a comment | 

This answer is helpful

-5

This answer is not helpful

View activity on this post.

Gracias por sus respuestas. Following a major investigation, discovered that the archive of the complemento donde se definió mi shortcode aparecía como “inactivo”. Una vez que moví mis definiciones de shortcode a un archivo activo, todo commenzó a funcionar. Hope that esto sea útil para cualquiera que se encuentre con esto en el futuro.

¡Gracias de nuevo!

To share

Share a link to this answer

Copy link CC BY-SA 3.0

Mejora esta respuesta

Seguir

Sigue esta respuesta para recibir notifications

answered on September 8, 2014 at 8:07 PM

dhundupothu user avatar

dhundupothu dhundupothu

113 1 1 gold badge 1 1 silver badge 3 3 bronze badges

1

  • Please accept the correct answer instead of yours.

    – Personal designs

    May 15, 2018 at 10:52 am

Add a comment | 

Your answer

Thanks for contributing with a response to WordPress Development Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid…

  • Ask for help, clarification, or respond to other responses.
  • Make statements based on opinion; back them up with references or personal experience.

To learn more, check out our tips for writing great answers.

Saved Draft

Draft rejected

Sign up or log in

Sign up with Google

Sign up using Facebook

Sign up using your email and password

Submit

Post as guest

Last name

E-mail

Required, but never displayed

Post as guest

Last name

E-mail

Required, but never displayed

Post your answer Ignore

By clicking “Post your answer” you agree to our Terms of Service, Privacy Policy and Cookies Policy

Not the answer you are looking for? Browse other tagged questions

  • small code

or ask your own question.

  • The overflow blog
  • We Hate Scrum and Agile… When Done Badly (Ep. 489)

  • Ethereum finally merges, semiconductors remain scarce (Ep. 490)

  • Featured on Meta
  • Recent color contrast changes and accessibility updates

Related

0

Can’t process php via shortcode

1

Remove action from shortcode

0

Identification of a page containing an `init` shortcode

3

Shortcode not working in html input

1

Can a shortcode return its own name?

1

custom post type category count shortcode

0

Shortcode of a function does not work

1

Shortcode inside class not working

0

When are shortcode attributes available in the template

Network burning questions

  • Why does Windows 10 list “Windows_NT” as the operating system?
  • During JS Bach’s lifetime, who listened to one of his preludes and fugues for organ and when?
  • Mac Studio display audio is choppy
  • var() is not equal to sd()^2 in R
  • Why do car turn signals flash at twice the speed when a turn signal light has burned out
  • Conversion from 24 VAC to 5 VDC with low output current
  • How to get rid of a large amount of wet sugar?
  • What is this yellow star?
  • Living room breaker will not turn on after pressure wash
  • Why the subjective “Owners’ equivalent rent of residences” is included in the CPI?
  • Is this a breathable atmosphere for human-like aliens that have more efficient oxygen-carrying blood? Normal humans would require a gas mask (oxygen)
  • Why can’t you say “A doll was made me by my sister”?
  • Trying to identify a novella by Poul Anderson
  • Post-concert routine for soloists?
  • Period of the propagator of quantum harmonic oscillators
  • Why did ‘scp 10.0.0.11:/home/someuser/.*’ start copying from /home as well?
  • Sum of an arbitrary number of random variables
  • How is expected approach time phrased in ATC communications?
  • What is this called and what causes it? Bright highlights along contrasting edges
  • Is there any known thing or physical object that absolutely cannot be destroyed?
  • Is James Earl Jones the actor who has played the same character for the longest time?
  • Could a pine forest with year-round snowfall survive?
  • Update multiple fields from float to integer in QGIS
  • What is stronger: an ability that can be used proficiency bonus times, or one that can be used once per short rest?

Question feed

Subscribe to RSS

Question feed

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Articles by category

  • How to WordPress
  • E-shop
  • How to create a good website
  • Advanced website creation
  • Registrace domény

WordPress shortcodes: how to insert shortcodes in WordPress?

WordPress shortcodes. Did you ever see a text within brackets in WordPress? Then you have seen a shortcode. Shortcuts add new features to your content and ease your work. Want to add a video, button or survey without using a code? WordPress shortcodes: how to insert shortcodes in

What are shortcodes?

Did you ever see a text within brackets in WordPress? Then you have seen a short code. Shortcodes in WordPress are:

“bits of small code that allow WordPress website users to do various things very easy. Without writing any code.”

WordPress introduced it in WordPress version 2.5. And look like this: [Active24-shortcode]. You can enter the special tags in several places on WordPress. It replaces the content, when a web visitor views its WordPress site.

When to use shortcodes in WordPress?

WordPress has several security checks and filters built in. To prevent malicious code to come into:

  • WordPress Posts
  • WordPress Pages
  • WordPress Widgets
  • WordPress Themes

So, users cannot write code in such WordPress elements. Yet, WordPress short codes allow its users to add “dynamic content” inside WordPress. Such as:

  • Insert graphics
  • Embed video files
  • Add galleries or responsive slider
  • Create macro objects
  • Create a survey form in WordPress
  • Add buttons

Such dynamic content would need writing a lot of code. Short codes simplify this process of adding features to a WordPress website. They add HTML and other dynamic markup languages. Into the post, page, widget or comment. Wherever the WordPress user wants them to appear. In one single line.

When Not to use shortcodes in WordPress?

Specific shortcodes are not needed if you only create one feature on a specific post or page. But, if you will use that shortcode in many different posts or pages, you may want to use a plugin to add a shortcode. This will make it easier to style a specific WordPress element. It is also easier to remove if you want to change Themes for example.

How are WordPress shortcodes provided?

You can provide WordPress short codes in several ways:

1. Inbuilt shortcodes

These are short codes included in the chosen WordPress Template under the content editor. Such as: “audio, caption, embed, gallery, and video”. These short code stop functioning, when you change the WordPress template.

TIP: Often WordPress users do not know which short codes are available already. To find out, use the shortcode reference plugin. It provides a detailed list of available short codes in the existing WordPress site.

2. Shortcode Ultimate Plugin

Lacking features in your WordPress editor? Then Shortcode Ultimate is a great solution. This WordPress plugin provides a free pack of versatile short codes. With this free plugin package you can insert, among others:

  • QR code generator
  • Gallery
  • Sliders
  • Responsive videos
  • Buttons with icons
  • Macro tables
  • Tabs and boxes
  • Audio
  • Google Map

This plugin prevents you having to install a dozen of plugins.

 

último complemento ukázka shortcode

After installation:

  • Login to WordPress Dashboard.
  • Click Insert Shortcode.
  • Chose the short code of your choice.

 

These short codes remain functioning after changing the WordPress template.

How to insert shortcodes in WordPress?

You can insert shortcodes in WordPress on:

  • WordPress Posts
  • WordPress Pages
  • WordPress Widgets
  • WordPress Themes

Some plugins offer the ability to paste into content through short codes. Putting the short code in the body of the Post or Page will perform its function.

1. Insert Short codes in WordPress Post

To insert shortcodes into a WordPress post:

  • Log in to the WordPress Dashboard with your login details.
  • In the navigation menu, click “Post
  • Click the post you want to edit.
  • Click “Text”.
  • Insert shortcode.
  • Click “Update” to save your changes.

CONSEIL : Pour utiliser le texte d’un code court dans un article WordPress, évitez d’utiliser des crochets doubles. Cependant, si vous souhaitez que le texte du shortcode vidéo s’affiche plutôt que la vidéo réelle, vous pouvez ajouter : .

2. Insérer un shortcode dans les pages WordPress

Pour insérer des shortcodes dans les pages WordPress :

Si vous souhaitez utiliser des codes abrégés à des endroits autres que le contenu, vous devez d’abord ajouter un widget de texte. Deuxièmement, insérez un shortcode dans la barre latérale des widgets WordPress ou dans les modèles WordPress :

3. Insérez des codes courts dans les widgets WordPress.

Pour utiliser des codes courts dans votre barre latérale WordPress Widgets :

  • Connectez-vous au tableau de bord WordPress avec vos informations de connexion.
  • In the navigation menu, click on “ Pages
  • Click on the page you want to edit.
  • Click on “  Text  ”
  • Add a shortcode.
  • Haga clic in ” Actualizar ” para guardar sus cambios.

    Ahora can insert direct access into a text and content widget.

    CONSEJO: Recuerde, esta función no está habilitada de manera predeterminada in WordPress. If no code can be abbreviated to a widget, you should add the previous code to the functions.php archive of your theme.

    4. Insert cortos codes in WordPress plantillas (avanzado)

    Find a shortcode in the WordPress theme

     

    Aquí hay un ejemplo de cómo se ve a shortcode:

    • Start the session in the WordPress panel with the session start data.
    • Arrastra y suelta a widget of texto in you barra lateral
    • Haz a small modification of code in el archivo functions.php.
    • At the end of the archive, pegue Add_filter (“widget_text”, “do_shortcode”);
    • Agregue su código corto de elección dentro de él.
    • Y Guardar cambios.
      • Abra the theme tapestry. Vaya has: “/wp-content/themes/su-tema-nombre/”
      • Abra el archivo functions.php o si el tema tiene una carpeta incluida, dentro de esa carpeta.
      • Abra los archives y busque el término add_shortcode.
    • function my_shortcode_function() { $i = ‘

      Hola Mundo!

      ‘; delegate $i; } add_shortcode(‘my-shortcode’, ‘my_shortcode_function’);  

      To create a tabla of advanced macros

      • Abra the theme tapestry. Vaya has: “/wp-content/themes/su-tema-nombre/”
      • Generate a new HTML table in the add-in configuration.
      • Assign a corto único code to the tabla: [id of supsystic-tables = 10].
      • Select the publication or page on which to insert the tabla.
      • Colloquium el código abridged.
      • Haga clic en Guardar para guardar sus cambios.

       

      It is also possible to use the shortcode in a theme area than not to sea a widget. Aggregates the following PHP function donde dessee mostrar el code: [example_shortcode] OF Echo do_shortcode (“[select_shortcode]”);

      SUGERENCIA: in the WordPress editor, the código agregado en el cuadro de texto todavía se muestra. No verá la tabla, sino el código que llama a la tabla, cuando lo vea el usuario. Sin embargo, su visiting web verá la tabla gráfica.

Item Certificate

Average rating: 4.2/5

Voice: 90

Related Articles

  • WordPress Themes: Use WordPress Plants
  • RSS WordPress: how to configure the RSS feed on WordPress?
  • Yoast SEO Addon: 4 Tips for WordPress Busqueda Engine Optimization
  • WordPress add-on: 4 irresistible free add-ons
  • ¿Dónde find quality free plants for WordPress?


Video WordPress shortcode not working

Related Posts

Fatal error require failed opening required

Contents1 Fatal error of PHP No se pudo to open the archive requerido2 Subscribe to RSS3 About WPML3.1 From day one, our priorities have remained the same…

Your media file could not be processed.

Contents1 Fixed: Twitter Error “Your media file could not be processed”1.1 freno de mano1.2 ClipChamp Créer1.3 FilmoraGo1.4 adobe sparkle2 Video Your media file could not be processed….

Gravity forms not sending email

Contents1 [SOLVED] Why doesn’t Gravity Forms send email?1.1 How does Gravity Forms send email?1.2 Résoudre les problèmes liés aux formulaires Gravity qui n’envoient pas d’e-mail1.3 Configure Gravity…

This webpage is not founderr_file_not_found

Contents1 Install and manage extensions1.1 Install trusted extensions1.2 Agregar o eliminar el acceso a un sitio específico1.3 Hide extensions1.4 Show extensions2 5 Ways To Permanently Fix Chrome…

Continue to this website not recommended missing

Contents1 Ignore the “Continue to this website (not recommended)” message1.1 publication information1.2 Information1.3 Contents1.4 Admin Items2 Internet Explorer 10 ‘Continue to this website’ is missing option2.1 Similar…

Error loading stream id not found on server

Contents1 JWPlayer 6 error message “Error loading stream: ID not found on server”1.1 Inscrivez-vous ou connectez-vous1.2 Post as guest1.3 Post as guest2 Subscribe to RSS3 Problems with…