FireSamurai
Forum Replies Created
-
Not a code fix, but as an FYI, if you tab into that field, it will let you make a selection. For some reason, it’s only when it’s clicked on that the problem arrises.
Forum: Hacks
In reply to: Switch/Case Doesn't recognize shortcode parameters. Why?Joey,
You’ve been super helpful, and I appreciate it. I’m sending all the good karma & juju your way right now.
Cheers!
Forum: Hacks
In reply to: Switch/Case Doesn't recognize shortcode parameters. Why?Thanks for everyone’s feedback and input. Here’s my new code, which is working:
add_shortcode( 'the_shortcode' , 'the_shortcode_function' ); function the_shortcode_function( $atts, $content=null ) { $output = ''; $the_shortcode_atts = shortcode_atts( array( 'term' => '', 'url' => 'https://originalurl.com' ), $atts ); $term = $the_shortcode_atts[ 'term' ]; $url = $the_shortcode_atts[ 'url' ]; $output .= '<a href="' . $url . '">Link text</a>'; switch( $term ) { case 'foo': $newurl = 'https://foourl.com'; $newoutput = str_replace($url, $newurl, $output); break; case 'bar': $newurl = 'https://barurl.com'; $newoutput = str_replace($url, $newurl, $output); break; default: $newoutput = 'Nothing here.'; } return $newoutput; }
If you have any further suggestions, I’m all ears. I’ll leave this ticket open for a couple days before closing, just in case.
Forum: Hacks
In reply to: Switch/Case Doesn't recognize shortcode parameters. Why?Hi Joey, thanks a ton for the explanation; it does help!
Forum: Hacks
In reply to: Switch/Case Doesn't recognize shortcode parameters. Why?RossMitchell. You are correct, I do need to. Hence my question. I want to understand the correct way of doing this so that I can write better code. If you are willing, could you explain the ‘why’ in your observations? Thanks.
Because my code isn’t working, I’m aware that $output is not set with the $url value. I can move $output into each of the individual cases and it will work that way. However, I’m trying to figure out if there’s a way to do it so that I don’t have to keep re-writing the output for each case.
Forum: Hacks
In reply to: Switch/Case Doesn't recognize shortcode parameters. Why?Thanks for the feedback. Because term is left empty in the shortcode attributes, the default case is displayed.
When tested,
[the_shortcode]
does indeed display the default case. However,
[the_shortcode term="foo"]
also displays the default case.If I change
return $output;
to
return "this is foo.";
then
[the_shortcode term="foo"]
will display, “this is foo.”(Hopefully having those on separate lines isn’t confusing to read.)
Because of this, I’m inclined to think the error lies with how I’m asking the switch to return $output. For some reason the $url parameter that is assigned in the individual case is not being recognized by the $output in that same case.
This isn’t a permanent fix, but will do until the plugin is updated in the repository.
Go to ‘wp-content/plugins/gensis-widget-amplified/widget.php’ and update line 112 from
$this->WP_Widget
to
parent::__construct
and then save. This is a temporary bandaid, but should do the trick until the plugin is updated (and hopefully this is fixed).
Hey there,
I’m not official support, but you can fix those errors (until next update) by defining the variables in the google-language-translator.php file.
Add the following code to (approximate) line 367 (the line after foreach ($this->languages_array as $key=>$value) {):
$english_flag_choice = 'us_flag'; $portuguese_flag_choice = 'brazilian_flag'; $spanish_flag_choice = 'mexican_flag'; $lang_attribute = '';
This will define the variables and remove the error message you’re getting.
Ahhh! Makes sense. Thank you.
Forum: Plugins
In reply to: [Simple Social Icons] Using SSI with 'the_widget' in headerHi Ron, thanks for replying. I figured that’s what I’d end up having to do, but was hoping there was some sort of conditional statement I was unaware of that would take care of it via functions.php.
Forum: Plugins
In reply to: [Simple Social Icons] Individual Coloured IconsHey, I don’t represent this plugin, it’s author, WP, or Genesis. I just came across this question and thought that perhaps this post is what you’re looking for:
Forum: Plugins
In reply to: [WP Ultimate Recipe] Is this plugin Search Engine Optimized for Recipes?Awesome! Much thanks. I’m going to give it a whirl on my site: https://thecookingdish.com. Looking forward to it.