Adding shortcode [closed]

Short codes are designed to be used by people without needing to code or access php files. Simply put that code in a post or page content. (add new post, edit post, and new page, edit page, etc. Save the post / page. and then the shortcode does it’s “magic” of creating the gallery on … Read more

How create a shortcode with html

Please use below code function html_show($atts) { $makearr = explode(“,”,$atts[‘content’]); if(isset($makearr) && !empty($makearr)) { foreach($makearr as $arrval){ $stringli .= ‘<li>’. $arrval.'</li>’; } } else { $stringli = ”; } $htmlcode=”<div class=”notify”><span class=”symbol icon-fact”></span> <strong>A kind of a notice box !</strong><ul>”.$stringli.'</ul> </div>’; return $htmlcode; } add_shortcode( ‘htmltag’, ‘html_show’ ); /*******Using method*******/ echo do_shortcode(‘[htmltag content=”message1,message2,message3,message4″]’);

Enclose article’s body with default shortcode

Thanks to @kero I have implemented this code: <?php echo do_shortcode(‘[responsivevoice voice=”Italian Female” buttontext=”Ascolta”]’.'<br>’.$bodyContent.'[/responsivevoice]’); ?> The $bodyContent variable contains the HTML value of the article’s body, obtained using this function: http://www.web-templates.nu/2008/08/31/get_the_content-with-formatting/index.html <?php $bodyContent = get_the_content_with_formatting(); ?>

A number appears inside a div called wpb_wrapper, when I use a custom shortcode

You can’t return an include like that. A successful include() itself returns 1, and since you’re returning the return value of include, your shortcode is displaying “1”. Handling Returns: include returns FALSE on failure and raises a warning. Successful includes, unless overridden by the included file, return 1. — http://php.net/manual/en/function.include.php If you want to output … Read more

Shortcode append to the the_content()

What your asking for can’t be done using shortcodes. <article> isn’t a part of the content, its part of the theme and it ‘contains’ the content. Thus shortcodes cannot modify it or move those tags around. Shortcodes by definition are part of the content, so anything they add on the end is also a part … Read more

Question about do_shortcode

There are number of ways to do it. The specific one for your case is that you have to find the function which that shortcode “calls”. For this, you can download your theme and plugin files and search add_shortcode or better product_categories(your shortcode name) term in all files using some notepad software. Notepad++ has a … Read more

How to Convert Shortcode into a link?

Wrap your shortcode in a div and give it an ID that you can use as a target when triggering your popup. For example, you can put the shortcode somewhere on your page (content, sidebar, etc) as follows: <div id=”popup” class=”lightbox”>[contact-form-7 id=”1735″ title=”Contact form 1″]</div> and the link that trigges the popup will look something … Read more

woocommerce Product shortcode create [closed]

Hello Here is the Shortcode you can use this it will give you title link and image of product. Put this code in functions.php file of your theme. add_shortcode(‘product_data’,’custom_product_function’); function custom_product_function($atts) { $post_id = $atts[‘id’]; $title = get_the_title($post_id); $link = get_the_permalink($post_id); $image = get_the_post_thumbnail($post_id); $data=”<div><a href=””.$link.'”><p>’.$title.'</p></a>’. $image.'</div>’; return $data; } And then add the shortcode … Read more

Shortcode Output Always Before Content [duplicate]

Return the HTML instead of the echo function dataservices_category($atts) { // Attributes extract(shortcode_atts(array( ‘id’ => ” ), $atts)); $html = “”; // Code if (isset($id)) { $categories = get_categories(‘child_of=” . $id); foreach ($categories as $category) { if ($category->parent != $id) { $html .=”<div style=”margin-left:50px;”>’; $html .='<h4>’ . $category->name . ‘</h4>’; } else { $html .='<h3>’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)