Hash Tags Work :)

I was living in Los Angeles and was doing notary public work. At the time I created a facebook fan page. I did a bunch of hash tags and to date I still receive 100 views per day.

Anyway, I now have a new fanpage for my freelance work/services. Anyone know where I can find the hot hash tags people are searching for?

WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)

This is really confusing me.

I’ve tried numerous things but cannot get appropriate results.

Here’s what I currently have for my query:

$  args = array(     'post_type' => 'product',     'tax_query' => array(         'relation' => 'AND',         array(             'taxonomy' => 'product_cat',             'field'    => 'slug',             'terms'    => array( 'ring' ),         ),         array(             'taxonomy' => 'product_tag',             'field'    => 'slug',             'terms'    => array( 'black', 'men' ),         ),     ), ); $  query = new WP_Query( $  args ); 

As you can see I am trying to return products in the product category ring that contain both the tags black AND men

It appears though the product_tag terms array which includes black and men, is returning posts that include the tag black OR the tag men in the ring category.

How do I get it so that only products that include BOTH the tags in the query are returned?

Thanks so much

Diplay product tags in shop page after each product name

I’m looking for a solution to add, in the shop page, for each product the according product tags. I intend to do this using a hook and place the product tags in the product_title_end location. I’ll use a plugin to enter the hook content.

Could anyone suggest the code that I should write into the hook in order to achieve this?


Reprinting tags with all attributes

I’m reworking a WordPress plugin that I’ve made which specifies image dimensions that are missing width and/or height attributes.

As you can see in my current version on GitHub, I manually list all of the attributes for the <img> tag (L38). However, if a user were to add custom attribute, it would get omitted since it’s not listed in my $ attributes variable:

# Before <img src="https://example.com/img.png" class="img" custom-attr="value"> # After <img src="https://example.com/img.png" class="img" width="100" height="30"> 

Creating a simple test file, I was able to update the regex to store all attributes that are found in the <img> tags. Yes, I’m aware of the recommendation to use DOMDocument, but it has caused more issues with WordPress in the past.

preg_match_all( '/(?:<img|(?<!^)\G)\h*([-\w]+)="([^"]+)"(?=.*?\/>)/', $  content, $  images ); 

In order to not fill up this post with too much code, I have the current working test file on my GitHub Gist here. You can also see the regex test here to verify.

Using var_dump( $ images );, this gives me the following output from my sample images (I added ... at the end of each array to save space):

    0 =>        array (size=19)         0 => string '<img src="https://placehold.it/250x100/99cc00/000.jpg?text=JPG"' (length=63)         1 => string ' alt="JPG"' (length=10)         2 => string '<img src="https://placehold.it/250x100.gif?text=GIF"' (length=52)         ...     1 =>        array (size=19)         0 => string 'src' (length=3)         1 => string 'alt' (length=3)         2 => string 'src' (length=3)         ...     2 =>        array (size=19)         0 => string 'https://placehold.it/250x100/99cc00/000.jpg?text=JPG' (length=52)         1 => string 'JPG' (length=3)         2 => string 'https://placehold.it/250x100.gif?text=GIF' (length=41)         ... 

My goal is to recreate the image tags with all of their attributes and values after the dimensions are calculated. From my tests, I’ve tried the following, but it hasn’t given me the results I’m expecting:

foreach ( $  images[1] as $  attributes[1] => $  value ) {     echo( '< img ' . $  value . '="' . 'value' . '" ><br>' ); } 

Remove pre and code tags from WordPress theme

WordPress has added both <pre> and <code> tags to my PHP embedded in a post.

Here’s an example

<pre><code>register_taxonomy( 'Books', 'post',  array(     'label' =&gt; __( 'Books' ), ) ); 

And here’s what it should look like

register_taxonomy( 'Books', 'post',  array(     'label' => __( 'Books' ), ) ); 

I know the arrow > symbol is changed by the code in my theme but the <pre> and <code> tags are added by WordPress.

Does anybody know a solution which would enable me to remove these tags so the code displays correctly?

What are the common practices to weight tags relations?

I am working on a webapp (fullstack JS) where the user create documents and attach tags to them. They also select a list of tags they are interested in and attach them to their profile.

I am not a math guy, but I did some NLP as hobbyist and learnt about latent semantic indexation: as I understand it, you create a table where you store each couple of words you parsed, and then add weight to each of these couples of words when both are found next to each other.

I was thinking of doing the same thing with tags: when 2 tags appear on the same document or profile, I increase the weight of their couple. That would allow me to get a ranking of the “closest” tags of a given one.

Then I remembered that I came across web graphs, where websites were represented in a 2D space (x and y coordinates) and placed depending on their links using an algorithm called force vector.

While I do know how I would implement my first idea, I am not sure about the second one. How do I spread the tag coordinates when created? Do they all have an x:0, y:0 at the start?

Since I assume this is a common case of data sorting, I wondered what would be the common/best practices recommended by people of the field.

Is there documents, articles, libraries (npm?) or wikipedia pages you could point me out to help me understand what can or should ideally be done? Is my first option a good one by default?

Also, please let me know in comments if I should add or remove a tag to this question or edit its title: I’m not even sure of how to categorize it.

A logical usage of heading tags and SEO

I have a dynamic school website (feed from a database), and I have it structured with different sections, for example.

  • Sports
  • Academic life
  • Our students

At first sight, it is pretty obvious that I could name the “Sports” section with a good nice h1 tag with the word “Sports”.

But as it is feed by articles by ID, something like articles.php?=134 (don’t worry about the rewrite mode for now) the same Heading 1 tag repeats over and over, and I could get penalized.

Now it is more obvious to use the actual title of the article as h1, for example, “Team 1 won over Team 2 on the summer event”

But now I have a new problem. The word “sports” is not used anymore, and this is a waste because we have several articles about sports. I want to use the word Sports, like the “good old paper newspapers” used to identify the sections.

enter image description here

What would be good practice for headings like this, considering SEO and actually identifying the section? A simple meaningless div, just for aesthetic purposes? A lower ranking heading? Stick to an h1 tag?

Image from pixabay.com

How to get different html tags from the content using regex?

I am trying to get different html tags from a single post and display them as nested accordion. I have quite accomplished. the only problem I have is that. When I try to show all the p tags content inside span but it shows only the first paragraph for each nested menu content.

Any solution will be most appreciated. Thanks

History 2020 Jan 10 This is first paragraph.

Feb 2 this is second paragraph

Mar 23 this is third paragraph

2019 Jan 20This is fourth paragraph.

Feb 30this is fifth paragraph

Mar 2this is sixth paragraph

‘; $ classesH = 100; for($ w = 1; $ w (.*?)/s’, $ sampleH, $ match); if($ match) { ?> (.*?)/s’, $ sampleH, $ match1); if($ match1) { ?>

(.*?)/s’, $ sampleH, $ match2); if($ match2) { ?>

var acc = document.getElementsByClassName(“accordion”); var i; var abc = document.getElementsByClassName(“accordion1”); var a; for (i = 0; i