Title: Comparing two variables
Last modified: May 18, 2021

---

# Comparing two variables

 *  [markofapproval](https://wordpress.org/support/users/markofapproval/)
 * (@markofapproval)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/comparing-two-variables/)
 * Hi, how do I compare a variable or PASS that contains the query string against
   the value of the field ID.
 * Basically, I want to add a class that will indicate the active panel selection
   so I can style it with CSS.
 * I understand how to get the query string ie ?solution=2 into a variable or pass
   it.
 * I understand how to get the field ID.
 * But I do not know how to compare a pass or variable to a field.
 * The documentation seems to indicate the compare won’t work for these types.
 * Thanks for the awesome plugin and eagerly awaiting your reply!

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

 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/comparing-two-variables/#post-14457167)
 *     ```
       [pass field=id]
       [if var=myquery value='{FIELD}']
         Do what you want
       [/if]
       [/pass]
       ```
   
 * or
 *     ```
       [pass vars]
       [if field=id value='{MYQUERY}']
         Do what you want
       [/if]
       [/pass]
       ```
   
    -  This reply was modified 4 years, 12 months ago by [polarracing](https://wordpress.org/support/users/polarracing/).
    -  This reply was modified 4 years, 12 months ago by [polarracing](https://wordpress.org/support/users/polarracing/).
 *  Thread Starter [markofapproval](https://wordpress.org/support/users/markofapproval/)
 * (@markofapproval)
 * [4 years, 12 months ago](https://wordpress.org/support/topic/comparing-two-variables/#post-14457586)
 * Hi, and thank you for your replay.
 * However, I was referring to an if statement comparing two passes like:
 * [if pass_1={FIELD1} pass_2={FIELD} compare]
 * Aside from using the math module and assigning them all to a flag, I could code
   a simple shortcode and share a link here to the gist if you want.
 *  [polarracing](https://wordpress.org/support/users/polarracing/)
 * (@polarracing)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/comparing-two-variables/#post-14459288)
 * If you are passing two fields, try:
 * `[if pass={FIELD1} value='{FIELD}']`
    -  This reply was modified 4 years, 11 months ago by [polarracing](https://wordpress.org/support/users/polarracing/).

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

The topic ‘Comparing two variables’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [polarracing](https://wordpress.org/support/users/polarracing/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/comparing-two-variables/#post-14459288)
 * Status: not resolved