Site logo

Archived topic

Styling php inside elements (hook)

6 replies · Started by sipahi on December 15, 2019

Viewing posts 1–7 of 7

Hello,

I am trying to insert a search box (not just icon) inside header navigation area. https://imgur.com/Qw27o1K this is what I am trying to accomplish.

I am creating an element and selecting hook and then do proper settings.

<?php get_search_form(); ?>

I need to style the php code above.

if it was a shortcode I could use

<div class="classname">[shorcode]</div>

now that it's a php code, can you please give me some idea in order to style it.

do you think the code below works?

echo '<div class="my_class">';
echo <?php get_search_form(); ?>;
echo '</div>';

my css and php knowledge is extremely limited. that's why I need help.

Thanks in advance

Hi there,

I'm not seeing the search box on your page currently.

Can you add it in so I can see?

Try just adding this first and make sure execute PHP is checked:
<?php get_search_form(); ?>

I enabled it.

As you can see it needs to be styled. But if I style it as is, then the sidebar search box also get affected. I think I need to assign a new class to it.

You should only have to make you CSS selector more specific like this:

.inside-navigation input[type="search"] {
    border-radius: 10px;
}

Thank you.

No problem :)

This archived topic is closed to new replies.