• Resolved ericathumma

    (@ericathumma)


    Hi Chris!

    I’ve been working with your Stream Data plugin and my client would like to add a “Status” line that states whether the stream is at the right level to kayak/canoe. I got half way there adding code to the usgs.php file in my child theme. I was able to successfully display different info based on the $gageheight value. The problem is that the water level data for low, good, and high is different for many streams. So, my thought was to add elseif variations by location. But, the following code doesn’t seem to be recognizing location the way I have it written. I’m sure there’s a better way to code this, but here’s what I have. Any suggestions?

    if($location = '01541500,01546400' && $gageheight ['value'] < 4.6){
     	 		echo "<li class='%s' style='color:#279ae0;'><strong>STATUS:</strong> Too Low to Go <em>(under 4.6ft)</em></li>";
    		} elseif($location = '01541500,01546400' && $gageheight['value'] >= 4.6 && $gageheight['value']<= 6){
        		echo "<li class='%s' style='color:#1fab40;'><strong>STATUS:</strong> Perfect for a Cruise! <em>(between 4.6ft & 6ft)</em></li>";
    		} elseif($location = '01541500,01546400' && $gageheight['value'] > 6){
       	 		echo "<li class='%s' style='color:#e90915;'><strong>STATUS:</strong> Too High to Ride <em>(above 6ft)</em></li>";
    		} else {
    				  echo "<li class='%s'><strong>STATUS:</strong> Unknown</li>";
    		}

    If this would require a crazy amount of work – too much to explain, I’d understand. 🙂

    Thanks in advance! -Erica

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chris Kindred

    (@chrismkindred)

    Thanks for reaching out Erica.

    If I were writing something to handle that I would add them as shortcode params, something like this:

    [USGS location='07164500' highGage=6 lowGage=4.6 /]

    That way you can check those variables if they exist and you don’t have to hard code any individual locations. I hope that helps but if not feel free to reach back out.

    • This reply was modified 4 years, 3 months ago by Chris Kindred.
    Plugin Author Chris Kindred

    (@chrismkindred)

    @ericathumma
    The newest version of the plugin (22.05.01) includes a new action that runs after the location title but before the values are listed out. This would provide you with a great place to echo content based on a value or a site is that is being displayed. Let me know if that ends up working well for your situation.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Adding Custom Status Note to Display’ is closed to new replies.