Include the phone number at the top of the menu and ensure it is optimized for mobile devices

The wordpress theme currently in use can be found here: https://wordpress.org/themes/total/

If you'd like to visit my website, it's located at

I'm looking to customize the theme by adding two phone numbers on the right side. Here's how I envision it:

For Desktop: https://i.sstatic.net/lHANQ.jpg

For Mobile: https://i.sstatic.net/WpKi6.jpg

I've tried using this HTML code but unfortunately, it didn't work as expected:

<div class="contact-phone"><i class="fa fa-phone" aria-hidden="true"></i> <a href="tel:+91-9996320362">+91-9996320362</a><br>
<a href="tel:+91-8708558959">+91-8708558959</a></div>

In addition, I've applied this CSS styling:

.contact-phone {
    display:block;
    text-align: right;
    font-size: 24px;
    line-height: 1.6;
    font-weight: 400;
    font-family: 'Oswald', sans-serif;
       }

Answer №1

Alright, let's get started!

To begin, navigate to your style.css file and replace the existing CSS with the code snippet below:

#ht-site-navigation {
  float: left;
  padding: 27px 0;
  transition: padding 0.3s ease 0s;
  width: 47%;
}
.contact-phone {
    display:block;
    text-align: right;
    font-size: 24px;
    line-height: 1.6;
    font-weight: 400;
    font-family: 'Oswald', sans-serif;
    float: right;
       }

Next, open your functions.php file and locate the following code:

function total_widgets_init() {

Add the new widget after this code like so:

register_sidebar( array(
        'name'          => esc_html__( 'Header Phone', 'total' ),
        'id'            => 'total-head-mobile',
        'description'   => __( 'Add widgets here to appear in Phone not on header.', 'total' ),
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h4 class="widget-title">',
        'after_title'   => '</h4>',
    ) );

Now, go to your header.php file and find the code block below where you should call your widget:

<div class="contact-phone">
                        <?php if(is_active_sidebar('total-head-mobile')): 
                            dynamic_sidebar('total-head-mobile');
                        endif;
                        ?>  
                    </div>

In the widget section at the back end, locate the "Header Phone" widget and add your phone number.

 <i class="fa fa-phone" aria-hidden="true"></i> <a href="tel:+91-9996320362">+91-9996320362</a><br>
<a href="tel:+91-8708558959">+91-8708558959</a>

For a visual reference, check out the screenshot here. Your frontend display will look like this: here.

If you're optimizing for mobile, add the following CSS to your style.css or any responsive directory file:

@media only screen  and (min-width: 320px)  and (max-width: 767px) {
#ht-site-navigation {
  padding: 0;
}
.contact-phone {
  position: relative;
  z-index: 999;
}
#ht-site-branding {
  float: left;
  width: 100%;
}

}

If you encounter any issues, feel free to leave a comment below.

Thank you!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Certain letters in the alphabet are unable to be underlined

Struggling to add underlines to certain characters in the alphabet such as p, y, g, and j? I can't seem to get them to show up correctly. Can anyone provide guidance on how to fix this issue? Here is the code I am using: <td style="text-decoratio ...

Looking for assistance with removing hardcoding in HTML and jQuery?

Currently working on a biography page for my company's website that features a grid layout of the employees' profile pictures. Each picture should be clickable, causing the screen to fade to gray and display an overlay with the respective person& ...

Element not found: {"method":"xpath","selector":"//*[@id='content container']

The error is occurring despite having the correct xpath in the code: Unable to locate element: {"method":"xpath","selector":"//*[@id='content column']... It seems like there might be multiple xpaths in the field. Here is the code snippet: dr ...

Creating multiple nested ng-repeats in an AngularJS table

Managing a large amount of data on users' availability by hour for multiple days can be challenging. The data is structured as follows: availData = { "date1":arrayOfUsers, "date2":arrayOfUsers, ... } arrayOfUsers= [ userArray, userArray, ... ] user ...

What is the best way to include an image link in an HTML page generated with golang?

I am a beginner in Go and web apps, and I am working on creating an app that retrieves menu items from a database and sends the item description along with a related picture link through an HTML page for a browser. The app will be running on a local networ ...

What is the best way to animate the preprending of a div in an AJAX response?

Here is the code I am currently working with: $.ajax({ type: 'POST', url: 'load_more.php', data: {val:myval}, success: function (data) { $("#load_current").prepend(data); ...

Having difficulty updating a web page while utilizing setInterval() and passing a function that utilizes document.write to display JavaScript content on the page

At the core of my issue lies a blank HTML page that incorporates a JavaScript file, with the following code in the JavaScript file: function doIt() { document.writeln("asdf"); } // Alternatively, you can use setTimeout setInterval("doIt()", 5000); Upon ...

In Safari, there seems to be some additional space on the right side of the bootstrap

Encountered an issue with Safari version 5.1.7 involving a row containing 12 columns which results in extra spacing to the right within the container. Below is the code snippet: CSS .wrapper { background:blue; } .wrapper .container { back ...

What is the best way to showcase a value in JavaScript using CSS styling?

I'm looking to customize the background, font style, and outline for both open and closed elements in the code snippet below: a.innerHTML = "We are Open now now."; a.innerHTML = "We are Closed, arm."; Additionally, I want to appl ...

Incorporate classes into multiple titles by utilizing the text within the title

Here is some HTML code: <tr class="more-options"> <td width="190px" valign="top" class="ms-formlabel"> <H3 class="ms-standardheader"> <nobr>Required Hidden 1&l ...

Modifying the appearance of a WordPress website with CSS styling

I am currently using WordPress and I am excited about making changes to the CSS style sheet. After visiting , I realized that there is no option for editing the 'CSS' under Appearance → Customize → 'CSS'. My usual process is going ...

How can the <animate /> tag be triggered using only CSS and HTML?

Looking for a way to trigger the animation rules of the <animate /> tag using only HTML and CSS. Is there a new standard in HTML and CSS that allows something like input:checked ~ svg animate {enabled:true;} coming up in 2020? Or some other creative ...

Center-aligned text animation in CSS3

My custom text includes a CSS3 animation. Check it out on this fiddle: http://jsfiddle.net/pwLxo78k/ In the animation, one part of the text ("I love") remains static while the other part changes dynamically. I'm trying to center my text while ensuri ...

The hyperlink is not functional

I'm embedding PHP code within an HTML page and using an href link, but it's not working. Here's the HTML+PHP code snippet: <div class="panel-body"> <div class="row"> <div class="col-md-12 space20"> & ...

Issue with displaying the second dropdown based on the selection made in the previous dropdown

I wanted to address a recurring issue that has been discussed in various posts, such as this one on Stack Overflow: Show a second dropdown based on previous dropdown selection Despite attempting numerous solutions suggested in those posts, I have not been ...

What steps can I take to stop the comments section on my WordPress website from taking up the entire screen?

After launching my WordPress website, I noticed that the comments section under each post is stretching across the entire width of the screen, instead of aligning with the margins like the rest of the page. Can someone advise on how to adjust the margins ...

Table formatting problem

I am looking to add borders only below each row in my table. td{ border-bottom-style: solid;} However, I am noticing a visible border break between columns. Can anyone advise on how to remove that? ...

Looking for assistance with accessing elements using the "document.getElementById" method in Javascript

Below is the code snippet I am working with: <html> <head> <script> function adjustSelection(option) { var selectList = document.getElementById("catProdAttributeItem"); if (option == 0) { ...

Tips on obtaining the element that was used as the event selector

I am facing a challenge with a specific issue. Within a div containing various elements, I have implemented a mouseover event. The issue arises when trying to target this particular div in the mouseover function, as there are multiple automatically genera ...

Sending data from Node.JS to an HTML document

Currently, I am working on parsing an array fetched from an API using Node.js. My goal is to pass this array as a parameter to an HTML file in order to plot some points on a map based on the API data. Despite searching through various answers, none of them ...