How to make drop down button only show on certain URLS

Viewed 34

I have a Word press multisite with subdirectory's for languages and want to put a button in the header but have different content and links for each subdirectory site .

Currently the button stays the same per subdirectory site. How to make the drop down button only show on certain URLS?

This is my code for the current button.

<div class="dropdown">
  <button class="dropbtn">Languages</button>
  <div class="dropdown-content">
    <a href="https://example.com/">English</a>
    <a href="https://example.com/de/">Deutsch</a>
    <a href="https://example.com/es/">Español</a>
    <a href="https://example.com/fr/">Français</a>
    <a href="https://example.com.cn/">中文</a>
1 Answers

Try this

<?php
$current_multisite = get_blog_details(get_current_blog_id());
//print_r($current_multisite);
?>

<div class="dropdown">
<button class="dropbtn">Languages</button>    
<div class="dropdown-content">
<a href="https://example.com/">English</a>

<?php
if ($blog_details->domain != 'example.com/de/') {
?>
<a href="https://example.com/de/">Deutsch</a>
<?php } ?>

<?php
if ($blog_details->domain != 'example.com/es/') {
?>
 <a href="https://example.com/es/">Español</a>
<?php } ?>
Related