J
J
jonghi2020-05-20 16:08:39
WordPress
jonghi, 2020-05-20 16:08:39

How to add your shortcode to wordpress?

There is an algorithm, suggested here: Copying text by clicking on the text itself?
As I understand it, to add your own tag, let's say

<copy> тут текст, по нажатию на который он скопируется в буфер обмена</copy>
you need to add a shortcode (this will be the easiest), how can I describe and add such a shortcode (tag), when concluded in which the text will be copied to the clipboard, for example:

Вот стандартная фраза, которую вы можете использовать в диалоге: 
<copy> тут текст, по нажатию на который он скопируется в буфер обмена</copy>
<i>* для копирования нажмите на текст</i>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2020-05-20
@jonghi

function bla_bla_bla( $atts, $content = null ) {

    $params = shortcode_atts( [
      'one'  => '',
      'two'  => '',
      'more' => '',
    ], $atts );

 # my_copy_text_function гипотетическая функция которая, что то у вас делает
    return my_copy_text_function( $params[ 'one' ], $params[ 'two' ], $params[ 'more' ], $content );

  }

  add_shortcode( 'my_short_code', 'bla_bla_bla' );

Using
[my_short_code one="" two="" more=""]Blah blah blah content[/my_short_code]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question