Show data obtained from a function and place it in a shortocode function

I don’t really understand what you’re trying to do. Why don’t you just call the function inside the shortcode handler? This looks more like general PHP question. Say we have a variable in our functions.php or wherever you define your shortcodes: $another_var = doSomeFunctionThatReturnsData(); With modern anonymous functions, you can pass variables using the use … Read more

How to construct a dynamic rewrite rule for child pages that passes more than one query var

First thing to check is make sure you visit permalinks page, or call the flush_rewrite_rules function once after you call add_rewrite_rules otherwise the rule will not get applied. So to restate your question, is it correct that you’re trying to achieve rewriting this: example.com/project-centers/kitchen/x/y/z To this: eample.com/index.php?pagename=kitchen&var1=x&var2=y&var3=z If that’s correct, your code looks like it … Read more

Why “?v=hash” is added to my URLs? [closed]

It was woocommerce, it has a setting “geolocalize users with cache support” which adds this parameter to every single url and link. I noticed that the hash appended was the same in every browser on my computer, so I realized it wasn’t a “session” hash, but an IP address hash.

Problem parsing long parameter in shortcode

After tinkering obsessively, I have solved the problem. As stated above, this is the failing shortcode entered in the post [product product_sell_price=$765 product_description=20”x16” oil on stretched linen. Varnished for protection and ease of cleaning. Includes the frame as shown and is ready to hang.] This is the shortcode that works perfectly: [product product_sell_price=$765 product_description=’20”x16” oil … Read more

RTrouble passing arguments to action

You have an action hook named use_colors_here and you run the hook using do_action( ‘use_colors_here’, $data ), but I don’t see where you call add_action() for that hook? I mean, the do_action() and add_action() should be used like so: // This adds a callback to the use_colors_here hook. add_action( ‘use_colors_here’, ‘some_function’ ); // And this … Read more

How to pass parameters in wordpress shortcode?

As the docs for add_shortcode() state, Every shortcode callback is passed three parameters by default, including an array of attributes ($atts), the shortcode content or null if not set ($content), and finally the shortcode tag itself ($shortcode_tag), in that order. Use the shortcode_atts() to define what attributes are allowed and set default values for those … Read more

Add a paramter to page url

If you were willing to use a plugin you could use Custom Post Type UI to create a “products” custom post type. Any post made inside this post type would give the permalink you wanted.

Append a parametter at first or last to a certain URL

I got my code working now. Here is the below code that append that extra parameter to the end of the URL specified above. add_action(‘init’, ‘add_custom_query_for_search’); function add_custom_query_for_search(){ global $wp; $tempUrl = home_url() . add_query_arg( $wp->query_vars ) . ‘&propertyType=RNT’; if( ! isset($_GET[‘propertyType’]) && (strpos($tempUrl, ‘homes-for-sale-search’) !== false) ){ wp_redirect($tempUrl); die; } }

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