javascript – How to change class atribute of a tag and apply styles without reloading the page

I’m trying to enchance the layour of my navigation menu bar.

Want I would want to acomplish is having a class style “active” for the item in the menu that is active, that means we clicked on it. The style for class “active” only highlights in blue the item in the navbar (the others “inactive” remain grey).

I tried using the onlick attribute that calls a JavaScript function makeActive() that changes the class of the clicked button of menu and changes all other classes of the navbar to “inactive”.

However I think I’m missing something about the DOM or AJAX because the styles doesn’t change the layout of the active button remains the same.

PD: I would want to archive this in purely vanilla JavaScript (not JQuery).


/* NavBar */

.topnav {
    background-color: #333;
    overflow: hidden;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;

.topnav a {
    float: left;
    color: #f2f2f2;
    text-decoration: none;
    text-align: center;
    padding: 8px 16px;
    font-size: 17px;

.topnav {
    background-color: rgb(49, 149, 250);
    color: white;

.topnav a:hover {
    background-color: #ddd;
    color: black;


<!DOCTYPE html>
        <title>Travel Agency</title>
        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="styles.css">


            function makeActive(id)
                var ancestor = document.getElementsByClassName('topnav');
                var descendents = ancestor(0).getElementsByTagName('*');

                for(var i=0; i < descendents.length; i++) {
                    if (descendents(i).className == "active" && descendents(i).id != id) {
                        descendents(i).className = "inactive";

                for(var i=0; i < descendents.length; i++) {
                    if (descendents(i).id = id) {
                        descendents(i).className = "active";



        <div class="topnav">
            <a class="active" id="home" href="#home" onclick="makeActive('home')">Home</a>
            <a class="inactive" id="offers" href="#offers" onclick="makeActive('offers')">Offers</a>
            <a class="inactive" id="travels" href="#travels" onclick="makeActive('travels')">Travels</a>
            <a class="inactive" id="galery" href="#galery" onclick="makeActive('galery')">Galery</a>
            <a class="inactive" id="contact" href="#contact" onclick="makeActive('contact')">Contact</a>
            <a class="inactive" id="about" href="#about" onclick="makeActive('about')">About</a>

php – Como obter o id tag da url do wordpress

Ola gostaria de saber como posso obter o ID contido dentro de uma url tag do wordpress, com configuração de url amigavel.
Exemplo : endereço-do-site/tag/moto

Eu já consegui fazer todo processo de consulta dos dados serilhados do wordpress e aplicar o id para aparecer a tag link, contudo eu não consegui pegar o texto contido na url ao lado da tag e converter ela novamente para para valor numerico, para que ela possa ser aplicado no while no campo meta_value.
Gostaria de saber como posso fazer isso.

Dados serilhados


Função get_categoria_link para gerar o link da tag atravez do id.

// Função que pega o ID da TAG para gerar o link
function get_categoria_link( $categoria ) {
    if ( ! is_object( $categoria ) ) {
        $categoria = (int) $categoria;

    $categoria = get_term_link( $categoria );

    if ( is_wp_error( $categoria ) ) {
        return '';

    return $categoria;

  // Aplica processo de unserialize nos dados
    $tipoMedia = maybe_unserialize(doo_isset($postmeta, 'tipo'));

foreach ($tipoMedia $tagLink) {
  echo get_categoria_link($tagLink).'</br>';

Area do processo de laço de repetição com base no id da tag contida na url.

// Query contendo os dados de tipo de media
$dadosDB = array(
 'post_type' => 'post',
 'meta_key'  => 'tipo',
 'meta_value'=> '323', // Valor da consulta
 'meta_compare' => 'LIKE',
 'order'     => 'ASC',
 'orderby'   => 'title'

$tipoList = new WP_Query($dadosDB);

while ($TipoList->have_posts()) { $TipoList->the_post();

// dados do loop aqui


Tag times in " " is protected

I want to take a derivative of the following expression and apply a substitution as well. The expression is,

Q_{xx}(t) = (mu * a^2 * (1-e^2)^2 * Cos(psi(t))^2 )/(1 + e * Cos(psi(t))).

The derivate of the above function has to be taken with respect to t and the following substitution has to be made,

psi(t)' = (1 + e * Cos(psi(t)))^2.

How to do this calculation if I have to take multiple derivatives? I keep getting some or the other error.

seo – robots meta tag for specific web crawler

<meta name="robots" content="index, follow">
<meta name="googlebot" content="index, follow, noimageindex">

Yes, this will “work” as intended, but can be simplified. Googlebot will merge the two and “will use the sum of the negative directives”, but there’s nothing to merge.

However, index and follow are the default actions and will simply be ignored. See the following related question: What is a difference in the order of “follow” and “index” in a robots meta tag?

So, the above could be simplified to a single element:

<meta name="googlebot" content="noimageindex">

If you don’t want images indexed by any bot (including Googlebot) that might support the noimageindex directive then you can “simplify” this further:

<meta name="robots" content="noimageindex">

Any bots (incl. Googlebot) that support noimageindex will honour it, those that don’t will ignore it. (This does assume that any other bots implementation is similar to that of Googlebot.)


What is a difference in the order of "follow" and "index" in a robots meta tag?

What is the difference between

<meta name="robots" content="follow, index">


<meta name="robots" content="index, follow">

Would either create any issue for indexing or crawling?

What is a Difference Between this 2 meta Robots tag?

<meta name="robots" content="follow, index,


<meta name="robots" content="index, follow,

Have a any any Issue Created in Indexing,Crawling ?

photon – BillBoard Name Tag Problem using Photon2 in unity

I’m using PUN2 and trying to use nametag billboards for my players but the camera is not facing correctly and i have to wait more than 20 seconds to make the name tag of player back to facing forward.

here’s my code for BillBoard Script:

public class BillBoard : MonoBehaviour
protected Transform ThisCameraPlayerBillBoard ;

    private void Start()
        ThisCameraPlayerBillBoard = GameSetup.GS.ThisCameraToBillBoard.GetComponent<Camera>().transform;


    private void FixedUpdate()
        transform.LookAt(transform.position + ThisCameraPlayerBillBoard .rotation * Vector3.forward,
            ThisCameraPlayerBillBoard .rotation * Vector3.up);

Anti-Virus Sees Tag Manager as HEUR:Trojan-PSW.Script.Generic

My anti-virus (KAV) warns me about HEUR:Trojan-PSW.Script.Generic as I visit some websites (for example I see this notification popping up pretty frequently. Has anybody got a similar problem? Is it only KAV issue?

Can you track subpages with Google Analytics/Google Tag Manager

I have a site that names all it’s subpages the following: /resource/name of page.html

We use a tag on the page to separate them by Information type for example: News, Policy, toolkit etc

The Information Type comes up at the top of the page as a URL, so that people can then click on that link and go to a page that brigades all those types together.

Could I use GA or GTM to pull only the “News” pages together or all the “Policy” pages together by picking up the URL on the page? Can it go that deep? Can you filter by content on page?

At the moment I can see every single “resource” page that has been read, but I need to sub categorise these pages to their type.

javascript – Google Tag Manager trigger for content in shadow-root?

How do I create a UA trigger that fires when a user clicks on content in a #shadow-root inserted using JavaScript?

HTML is as follows, where the site I am working on is “site_A” and the site the inserted content is from is “site_B”:

<div class="site_A_class">
  <script src="site_B/script.js" ...></script>

In FF developer view, HTML appears as follows:

<div class="site_A_class">
  <script src="site_B/script.js" ...></script>
      <a class="click_me" href="site_B/url.html">...</a>

I want a trigger that fires when a user clicks on a.click_me. Things I have tried: (1) “click – just links” trigger with “click URL contains site_B”; (2) “click – all elements” with “click element matches CSS selector div.site_A_class”; (3) same, but matching “.site_A_class div div a”.; (4) “click – just links” trigger with “click class contains click_me”. Nothing fires.

Can it be done? If so, I’d appreciate pointers.