How to put an “include” inside a “do_shortcode”?

You won’t be able to concatenate an include as it doesn’t return a string. What you could do is store that include content in a variable, and then concatenate. ob_start(); include ‘incMac.php’; $include_content = ob_get_clean(); echo do_shortcode( ‘[student]’ . $include_content . ‘[/student]’ ); ob_start tells php to store the output from the script in an … Read more

How to: How do I make my own shortcodes without plugins?

You’ll probably need to modify this a bit to ensure things get placed where you want them but here’s something I wrote that counts views on posts and displays the view counts for administrators: //ADD TRACKER FUNCTION TO ALL SINGLE VIEWS function custom_hook_tracker( $post_id ) { if( !is_single() ) return; if( empty( $post_id ) ) … Read more

Shortcode But Without The Equals Sign?

Try this: function font_fam($atts, $content = null) { extract(shortcode_atts(array( ‘f’ => isset($atts[0]) ? $atts[0] : ” , ), $atts)); return ‘<span style=”font-family:’ . $f . ‘”>’ . $content . ‘</span>’; } add_shortcode (‘f’,’font_fam’);

Dynamically create shortcodes using add_shortcode and a callback

the shortcodes doesn’t shop up in the liste because it’s not a valid declaration with a valid function callback on the 2nd argument try this to see what append : // shortcode data add_filter(“shortcode_list”, function ($shortcode_list) { $shortcode_list[“slugA”] = array( “html” => “test html 1”, ); return $shortcode_list; }); add_filter(“shortcode_list”, function ($shortcode_list) { $shortcode_list[“slugB”] = … Read more

Can a shortcode function this way

Yes. That result can be achieved by single shortcode function. Here is your code- function paragraph_shortcode( $atts, $content = null ) { $pull_atts = shortcode_atts( array( ‘value’ => 0 ), $atts ); return ‘You are reading paragraph ‘ . wp_kses_post( $pull_atts[ ‘value’ ] ) . ‘: ‘ . do_shortcode($content); } add_shortcode( ‘paragraph’, ‘paragraph_shortcode’ ); It’ll … Read more

How can I get the current user email instead of user ID?

you can get all logged in users details by below function <?php $current_user = wp_get_current_user(); /** * @example Safe usage: $current_user = wp_get_current_user(); * if ( !($current_user instanceof WP_User) ) * return; */ echo ‘Username: ‘ . $current_user->user_login . ‘<br />’; echo ‘User email: ‘ . $current_user->user_email . ‘<br />’; echo ‘User first name: ‘ … Read more

Extending Shortcode attributes

Without seeing your code it is difficult to give you an exact answer. There is the shortcode_atts_{$shortcode} filter that was introduced in WordPress 3.6. All attributes is run through this filter. It has to be noted that the $shortcode parameter needs to be set in shortcode_atts. I haven’t seen shortcodes yet that has this parameter … Read more

Problem with email_exists in shortcode

This is a basic version of your code above which seperates the registration logic (handled on init) from the form output done by the shortcode. It will basically work, but is missing any validation so just to show the concept. $wpse_email_exists = null; function registration_form_shortcode() { global $wpse_email_exists; $output=”<form name=”registration” action=”” . esc_url($_SERVER[‘REQUEST_URI’]) . ‘” … Read more

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