I am trying to hide this button:
<button onclick="window.location.href='/';">About Me</button>
The entire HTML (for that specific section) is (including the title):
<aside id="secondary" class="widget-area">
<div class="about-wrapper">
<h2 class="widget-title">About Me</h2>
<p class="about-copy"> text </p>
</div>
</aside>
The Page ID is 52, I checked in the code and saw this:
<body class="page-template-default page page-id-52 no-sidebar">
The issue is that there isn't a CSS class....maybe I should add one - or - is there another way to hide this JavaScript button per Page ID in WordPress?
I am trying to hide this button:
<button onclick="window.location.href='https://example/about/';">About Me</button>
The entire HTML (for that specific section) is (including the title):
<aside id="secondary" class="widget-area">
<div class="about-wrapper">
<h2 class="widget-title">About Me</h2>
<p class="about-copy"> text </p>
</div>
</aside>
The Page ID is 52, I checked in the code and saw this:
<body class="page-template-default page page-id-52 no-sidebar">
The issue is that there isn't a CSS class....maybe I should add one - or - is there another way to hide this JavaScript button per Page ID in WordPress?
Share Improve this question edited Apr 11, 2020 at 12:44 Henry asked Apr 11, 2020 at 12:19 HenryHenry 9831 gold badge8 silver badges31 bronze badges 5 |1 Answer
Reset to default 1so if you want to remove/hide only the button can do this: 1 - if you have a specific class that hide a element //$class = "youre class";
<button class="<?php if(is_page($page_id)){ echo $class } ?>"
onclick="window.location.href='https://example/about/';">About Me</button>
2 - inline style
<button <?php if(is_page($page_id)){ echo "style="display: none"; } ?>"
onclick="window.location.href='https://example/about/';">About Me</button>
page-id-52
class is actually present? – Himad Commented Apr 11, 2020 at 12:20