Dynamic HTML not displaying at respective place

You’re getting the output there because dynamic_sidebar() displays/echoes the output (widgets in the specific sidebar), so the output is echoed right when the shortcode function is called, which is before the $data is actually echoed. And you can fix that using output buffering: Either append the output to $data: $data.='</div>’; $data.='<div class=”col-xl-4 col-lg-4 col-md-4 col-sm-12 … Read more

Add/echo div with Analytics-Code to function in functions.php

echo (‘<div onClick=”ga(‘send’, ‘event’, ‘will-ich-haben’, ‘klick’, ‘test-klick’);”>’); I haven’t looked any further but as a first step, this string isn’t concatenated correctly. echo “<div onClick=’ga(‘send’, ‘event’, ‘will-ich-haben’, ‘klick’, ‘test-klick’)’></div>”;

How to protect own PHP code from WordPress updates

NEVER EVER alter any template or file in a theme or plugin that you did not author, and this goes for any core file as well. There is no way to protect the code that you alter or add in any of those files, except maybe changing file permissions, but then again, you will run … Read more

Gallery shortcode menu order fix no longer working on WordPress 4.0

What I found to work for me was to remove the action within the foreach ending with the following code function pmc_gallery_menu_order_fix($id) { $regex_pattern = get_shortcode_regex(); preg_match (“https://wordpress.stackexchange.com/”.$regex_pattern.’/s’, stripslashes($_POST[‘content’]), $regex_matches); if ($regex_matches[2] == ‘gallery’) : $attribureStr = str_replace (” “, “&”, trim ($regex_matches[3])); $attribureStr = str_replace (‘”‘, ”, $attribureStr); $attributes = wp_parse_args ($attribureStr); endif; $ids … Read more

How to list all active and specific shortcodes in wordpress

The conditional needs to test against strings which would be the name of the shortcode. If you’re looking for the [hello] shortcode the conditional would look like: echo ‘<pre>’; print_r( $shortcode_tags[‘hello’] ); echo ‘</pre>’; So if you use add_shortcode() the string you’ll be looking for is the first parameter: $tag.

Specific loop in Shortcode

Ok mate – i got you… you should really break into 2 shortcodes. One as a wrapper (which is really short) and the other for the content… Example: add_shortcode(‘servicewrap’, ‘service_wrapsc’); function service_wrapsc($atts, $content = null) { return ‘<div class=”service”><div class=”container”><div class=”row”>’.do_shortcode($content).'</div></div></div>’; } add_shortcode(‘servicesingle’, ‘service_singlesc’); function service_singlesc($atts, $content = null) { extract(shortcode_atts(array( ‘icon’ => ‘fa-briefcase’ ), … Read more

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