Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sounds like you are looking for wordpress conditional tags. For example: </p> <pre><code>&lt;div id="sidebar"&gt; &lt;ul id="themenu" class="sf-menu sf-vertical"&gt; &lt;li&gt;&lt;a href="index.php" class="topm &lt;?php if (is_home()) { echo "currentMenu"; } ?&gt; nosub"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="about-us.php" class="topm &lt;?php if (is_page('about-us')) { echo "currentMenu"; } ?&gt; nosub"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>The first nav line checks to see if the current page is the homepage, if so it prints the required tag for the menu. The second line checks to see if the page is the "about-us" page, where "about-us" is the post_name (slug). You could also use the post ID. For more examples/references of available relevant tags, check my link below. Hope this helps.</p> <p>Reference: <a href="http://codex.wordpress.org/Conditional_Tags" rel="nofollow noreferrer">http://codex.wordpress.org/Conditional_Tags</a><br> Reference: <a href="http://codex.wordpress.org/Dynamic_Menu_Highlighting" rel="nofollow noreferrer">http://codex.wordpress.org/Dynamic_Menu_Highlighting</a></p> <p>To do this in standard PHP, avoiding using wordpress as platform, you could do something like this, or just assign a variable of the specific pages directly:</p> <pre><code>&lt;?php $path = $_SERVER['PHP_SELF']; // get the path to the file $page = basename($path); // grab the filename $page = basename($path, '.php'); // remove the .php extension ?&gt; &lt;div id="sidebar"&gt; &lt;ul id="themenu" class="sf-menu sf-vertical"&gt; &lt;li&gt;&lt;a href="index.php" class="topm &lt;?php if ($page == "index") { echo "currentMenu"; } ?&gt; nosub"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="about-us.php" class="topm &lt;?php if ($page == "about-us") { echo "currentMenu"; } ?&gt; nosub"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload