wordpress custom theme using php - php

I need a help in WordPress custom theme using PHP development, I was created language dropdown with images and in configure with Gtranslator Plugin, it`s work properly but when I select other language flag can't change in Dropdown.
my Code is given below:
<li class="dropdown">
<a href="JavaScript:void(0)" class="dropdown-toggle" data-toggle="dropdown"><img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/usaicon.png">
<i class="fa fa-angle-down" aria-hidden="true"></i>
</a>
<ul class="dropdown-menu dropdown_language">
<li><a onclick="doGTranslate('en|en')" href="JavaScript:void(0)">
<img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/usaicon.png">
</a>
</li>
<li id="cn"><a onclick="doGTranslate('en|zh-CN')" href="JavaScript:void(0)">
<img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/chinaicon.png">
</a>
</li>
<li><a onclick="doGTranslate('en|es')" href="JavaScript:void(0)">
<img class="lang_icon" src="<?php echo get_stylesheet_directory_uri();?>/images/mexiconicon.png">
</a>
</li>
</ul>
</li>

Related

Bootstrap navbar toggler icon is not working on mobile

hope you are all doing well, i have just face a problem. i make my website online. everything working well expect navbar toggler icon. it is not working on mobile device. it is working well on desktop
here is my code
<nav class="navbar navbar-expand-md navbar-light bg-light sticky-top">
<div class="container-fluid">
<a class="navbar-brand" href="index.php"><img src="./assests/images/logo.png" class="logo ml-5" alt="file not found" /> </a>
<button class="navbar-toggler " type="button" role="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"> </span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item <?php if($page == 'home') echo 'active' ?>">
<a class="nav-link " href="index.php"><i class="mr-2 fas fa-home"> </i>Home </a>
</li>
<li class="nav-item <?php if($page == 'about') echo 'active' ?>">
<a class="nav-link" href="about.php"><i class="mr-2 fas fa-users"> </i> About Us</a>
</li>
<li class="nav-item dropdown <?php if($page == 'products') echo 'active' ?>" >
<a class="nav-link dropdown-toggle dropdown-toggle-split" href="products.php" data-toggle="dropdown" id="dropedownMenuButton"aria-expanded="false" aria-hospopup="true" >
<i class="mr-2 fas fa-wrench"> </i>Products
</a>
<ul class="dropdown-menu" aria-labelledby="dropedownMenuButton">
<li class="list-group-item">
<a class="dropdown-item" href="bolts-screws.php"> Bolts/Screws </a>
</li>
<li class="list-group-item">
<a class="dropdown-item" href="nuts.php"> Nuts </a>
</li>
<li class="list-group-item">
<a class="dropdown-item" href="washers.php"> Washers </a>
</li>
<li class="list-group-item">
<a class="dropdown-item" href="screws.php"> Screws </a>
</li>
<li class="list-group-item">
<a class="dropdown-item" href="socket-bolt-screws.php"> Socket Bolts/Screws </a>
</li>
<li class="list-group-item">
<a class="dropdown-item" href="anchor-fastener.php"> Anchor Fasteners </a>
</li>
</ul>
</li>
<li class="nav-item <?php if($page == 'connect') echo 'active' ?>">
<a class="nav-link" href="connect.php"><i class="mr-2 fas fa-user"> </i> Contact us </a>
</li>
</ul>
</div>
</div>
</nav>
you can check my website also
http://rudrafasteners.com/
It seems you don't add Javascript at your head. Add the followings lines to your HTML <head> tag (Jquery and Bootstrap JS):
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

URL being appended to the previous URL (the older version of Laravel)

I am working with the older version of Laravel and I don't which version I am working on as this project was given to me for debugging. I have zero knowledge of Laravel. Doing php artisan --version gave me this as an output in git bash
Following is the code:
<nav class="sidebar sidebar-offcanvas" id="sidebar">
<ul class="nav">
<li class="nav-item nav-profile">
<div class="nav-link">
<div class="user-wrapper">
<div class="text-wrapper">
<p class="profile-name"><?php echo GetUserDetail::get(Session::get('admin_id'),'fullname');?> <span class="status-indicator online"></span></p>
</div>
</div>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="dashboard" style="background-color: #518be6 !important; width:250px; color: #fff !important; border-radius: 0px;">
<i class="fas fa-tachometer-alt menu-icon" style="color: #fff"></i>
<span class="menu-title">ड्याशबोर्ड</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="service">
<i class="fas fa-briefcase menu-icon"></i>
<span class="menu-title">सेवाहरू</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="resource">
<i class="fab fa-osi menu-icon"></i>
<span class="menu-title">संसाधन</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="agenda">
<i class="fab fa-forumbee menu-icon"></i>
<span class="menu-title">परियोजना</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="profile">
<i class="fas fa-people-carry menu-icon"></i>
<span class="menu-title">प्रोफाइल</span>
</a>
</li> <li class="nav-item">
<a class="nav-link" href="notice">
<i class="fas fa-info-circle menu-icon"></i>
<span class="menu-title">सूचना तथा जानकारी</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="add_user">
<i class="fas fa-user-plus menu-icon"></i>
<span class="menu-title">थप प्रयोगकर्ता</span>
</a>
</li>
</ul>
</nav>
I tried keeping / just before href like href="/dashboard". My expected output is http://demo.com/admin/dashboard but when I click on the link it goes like this http://demo.com/dashboard.
I also tried doing href="{{ url('dashboard')}}" which converts my URL to like this:
http://demo.com/admin/%7B%7B%20url('dashboard')%7D%7D
What should be done to fix this?
Your short fix would be this,
href="/admin/dashboard"
The problem was with the way html use href attribute. When you put '/' (forward slash) at the very beginning it starts from the root directory not from the current directory.
However this is a bad practice. You should study routing method and url generation . For large project your url controller will be much easier.
(I don't know your version of laravel. So I provided the link of the latest version. But you can change it from menu.)

Why is my p element in single.php not being implemented?

I work for this organization, Vibro, and I am website responsible. We have a sharing box with social icons on everyone of our articles. We want to add the text "del:" (Meaning share in norwegian) in front of the icons in the box. When I went into single.php and added a paragraph element with the text, the code won't be implemented.
Do you have any idea why, and how to fix it?
I've already tried: corrected syntax error, deleted cache and minified css, tried indenting with space and put the p element outside the ul. Does not work! Maybe the changes takes some time to be implemented, I made some changes earlier today that didn't go through before later.
Here's the code in single.php:
<div class="box-social">
<ul class="social social</ul>
<p>Del:</p>
<li>
<a class="circle-icon" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>&title=<?php the_title(); ?>&summary=&source="><i class="fa fa-linkedin" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://twitter.com/home?status=<?php the_permalink(); ?>"><i class="fa fa-twitter" aria-hidden="true">
</i>
</a>
</li>
</ul>
</div>
The code you provided has invalid markup.
You can use something like this https://validator.w3.org/#validate_by_input to validate your html.
One issue with your code is Element p not allowed as child of element ul in this context.
I fixed the broken <ul> and moved the <p> before it.
<div class="box-social">
<p>Del:</p>
<ul class="social social">
<li>
<a class="circle-icon" target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>&title=<?php the_title(); ?>&summary=&source="><i class="fa fa-linkedin" aria-hidden="true"></i>
</a>
</li>
<li>
<a class="circle-icon" target="_blank" href="https://twitter.com/home?status=<?php the_permalink(); ?>"><i class="fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
</ul>
</div>

Links are not fully working after adding active class with php

I'm using php to add active link state to my navigation menu which is shared dynamically across all my website pages. But when I go to other links from homepage it works fine but when I go back to homepage its give me "object not found" error.
<!--start vertical menu-->
<?php
$index="menu-items";
$top_albums_default="menu-items";
$Topartists="menu-items";
$Toplists="menu-items";
$Charts="menu-items";
$menuLinkid=basename($_SERVER['PHP_SELF'],".php");
if($menuLinkid=="index"){
$index='active';
}else if ($menuLinkid=="top_albums_default"){
$top_albums_default='active';
}else if ($menuLinkid=="Topartists"){
$Topartists='active';
}else if ($menuLinkid=="Toplists"){
$Toplists='active';
}else if ($menuLinkid=="Charts"){
$Charts='active';
}
?>
<div id="vertical-menu">
<!--<h2 class="logo">LOGO</h2>-->
<img class="logo" src="../Graphics/icons/logo.png" alt="LOGO"/>
<h6 class="logo-desc">Arcade Music Repository</h6>
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>
<li>
<a class="<?php echo $top_albums_default; ?>" href="Top-albums/top_albums_default.php"><i class="arcd-music97"></i></br>Top albums</a>
</li>
<li>
<i class="arcd-microphone52"></i></br>Top artists
</li>
<li>
<i class="arcd-numbered8"></i></br>Top lists
</li>
<li>
<i class="arcd-rising9"></i></br>Charts
</li>
</ul>
</div>
<script type="text/javascript" src="../js/jquery-1.11.3.min.js"> </script>
Please check this in video
Here is my site folders structure
You are missing a forward slash on your homepage link.
Make it like this:
<ul class="menu-items">
<li>
<a class="<?php echo $index; ?>" href="/index.php" ><i class="arcd-archive" ></i></br>Browse</a>
</li>

HTML CSS : <li> items are duplicating resulting in duplicate images

For some reason the <li> items are duplicating in my wordpress site. I have isolated the code in the header.php file to what you see below. I also don't think the problem is in the CSS but I cant figure out what is causing this.
The code going in looks like this:
<div id="toplinks">
<ul id="links">
<li><a class="narch"/> </li>
<li><a href="http://www.torhs.com" title="TORHS" class="torhs" target="_blank" /> </li>
<li><a href="http://www.omrha.com" title="OMRHA" class="omhra" target="_blank" /></li>
<li><a href="http://www.jangosportswear.com" title="JANGO" class="jango" target="_blank" /> </li>
<li><a href="http://www.statewarshockey.com" title="State Wars" class="statewars" target="_blank" /> </li>
<li><a href="#" title="Wicked Biscuit" class="wickedbiscuit" target="_blank" /> </li>
<li><a href="#" title="Rattlers" class="rattlers" target="_blank" /> </li>
<li><a href="http://www.revisionhockey.com" title="Revision Hockey" class="revision" target="_blank" /> </li>
<li><a href="http://www.rollerhockeyalliance.com" title="RHA" class="RHA" target="_blank" /> </li>
<li><a href="http://www.rinkrathockey.com" title="Rink Rat" class="rinkrat" target="_blank" /> </li>
<li><a href="http://www.rocketpuck.com" title="Rocket Puck" class="rocketpuck" target="_blank" /> </li>
<li><a href="http://www.missionhockey.com" title="Mission" class="mission" target="_blank" /> </li>
</ul>
</div> <!--clooses toplinks-->
The code coming out (taken using firebug) looks like this.
<ul id="links">
<li>
<a class="narch"> </a>
</li>
<a class="narch"> </a>
<li>
<a class="narch"></a>
<a class="torhs" target="_blank" title="TORHS" href="http://www.torhs.com"> </a>
</li>
<a class="torhs" target="_blank" title="TORHS" href="http://www.torhs.com"> </a>
<li>
<a class="torhs" target="_blank" title="TORHS" href="http://www.torhs.com"></a>
<a class="omhra" target="_blank" title="OMRHA" href="http://www.omrha.com"></a>
</li>
<a class="omhra" target="_blank" title="OMRHA" href="http://www.omrha.com"> </a>
<li>
<a class="omhra" target="_blank" title="OMRHA" href="http://www.omrha.com"></a>
<a class="jango" target="_blank" title="JANGO" href="http://www.jangosportswear.com"> </a>
</li>
<a class="jango" target="_blank" title="JANGO" href="http://www.jangosportswear.com"> </a>
<li>
<a class="jango" target="_blank" title="JANGO" href="http://www.jangosportswear.com"></a>
<a class="statewars" target="_blank" title="State Wars" href="http://www.statewarshockey.com"> </a>
</li>
<a class="statewars" target="_blank" title="State Wars" href="http://www.statewarshockey.com"> </a>
<li>
<a class="statewars" target="_blank" title="State Wars" href="http://www.statewarshockey.com"></a>
<a class="wickedbiscuit" target="_blank" title="Wicked Biscuit" href="#"> </a>
</li>
<a class="wickedbiscuit" target="_blank" title="Wicked Biscuit" href="#"> </a>
<li>
<a class="wickedbiscuit" target="_blank" title="Wicked Biscuit" href="#"></a>
<a class="rattlers" target="_blank" title="Rattlers" href="#"> </a>
</li>
<a class="rattlers" target="_blank" title="Rattlers" href="#"> </a>
<li>
<a class="rattlers" target="_blank" title="Rattlers" href="#"></a>
<a class="revision" target="_blank" title="Revision Hockey" href="http://www.revisionhockey.com"> </a>
</li>
<a class="revision" target="_blank" title="Revision Hockey" href="http://www.revisionhockey.com"> </a>
<li>
<a class="revision" target="_blank" title="Revision Hockey" href="http://www.revisionhockey.com"></a>
<a class="RHA" target="_blank" title="RHA" href="http://www.rollerhockeyalliance.com"> </a>
</li>
<a class="RHA" target="_blank" title="RHA" href="http://www.rollerhockeyalliance.com"> </a>
<li>
<a class="RHA" target="_blank" title="RHA" href="http://www.rollerhockeyalliance.com"></a>
<a class="rinkrat" target="_blank" title="Rink Rat" href="http://www.rinkrathockey.com"> </a>
</li>
<a class="rinkrat" target="_blank" title="Rink Rat" href="http://www.rinkrathockey.com"> </a>
<li>
<a class="rinkrat" target="_blank" title="Rink Rat" href="http://www.rinkrathockey.com"></a>
<a class="rocketpuck" target="_blank" title="Rocket Puck" href="http://www.rocketpuck.com"> </a>
</li>
<a class="rocketpuck" target="_blank" title="Rocket Puck" href="http://www.rocketpuck.com"> </a>
<li>
<a class="rocketpuck" target="_blank" title="Rocket Puck" href="http://www.rocketpuck.com"></a>
<a class="mission" target="_blank" title="Mission" href="http://www.missionhockey.com"> </a>
</li>
<a class="mission" target="_blank" title="Mission" href="http://www.missionhockey.com"> </a>
</ul>
<a class="mission" target="_blank" title="Mission" href="http://www.missionhockey.com"> </a>
</div>
<a class="mission" target="_blank" title="Mission" href="http://www.missionhockey.com"> </a>
You might be confusing HTML with XML-style markup.
The most basic link is marked up like so:
Google
The title attribute is actually what shows for the element's tooltip.
<a class="narch"/>
Close your anchors correctly

Categories