teleren/devto huggingface dataset:
Exclude Pages from WordPress Search Results
Tags: php, webdev, wordpress
Published: 2021-02-08 23:48:26

After performing a search on your WordPress website, have you noticed that pages are included in the search results? Would you prefer to exclude pages from your search results since they might not be as relevant? Let’s learn how!

## Exclude Pages

To exclude pages from your WordPress search results, we’ll make use of a filter hook called [pre_get_posts](https://developer.wordpress.org/reference/hooks/pre_get_posts/).

Navigate to Appearance > Theme Editor and open the template file in your theme called **functions.php**. Add the following code to it.

```php
add_filter( 'pre_get_posts', 'my_pre_get_posts' );
```

The second parameter in the add_filter function is the name of the function you want to call. Let’s create that function now. It receives the [WP_Query](https://developer.wordpress.org/reference/classes/wp_query/) instance as an argument. Let’s call it **$query**.

```php
// Adjust post content.
function my_pre_get_posts( $query ) {
 
}
```

Let’s continue adding to the function. First, we’ll ignore doing anything if this is an admin page using the [is_admin](https://developer.wordpress.org/reference/functions/is_admin/) function. We also want to ignore doing anything if the current query is not the main query using the [is_main_query](https://developer.wordpress.org/reference/functions/is_main_query/) function.

```php
// Don't apply filter if it's an admin page or current query is not the main query
if ( is_admin() || !$query->is_main_query() ){
  return;
}   
```

Now we’ll check if the current query is a search query using the [is_search](https://developer.wordpress.org/reference/functions/is_search/) function. If it is, we’ll set the post type to just include posts, which will exclude pages from search results.

```php
if ( $query->is_search() ) {
  // Exclude pages from search results.
  $query->set( 'post_type', 'post' );
}
```

Finally, we return the adjusted query.

```php
return $query;
```

You have successfully excluded pages from your WordPress search results!

> Keep in mind that if you switch to a different theme, you would lose this functionality because it was added to your current theme’s functions.php file. If you want this functionality to persist, make it a WordPress plugin instead.

---
#### Visit our website at [https://nightwolf.dev](https://nightwolf.dev) and follow us on [Facebook](https://www.facebook.com/NightWolfDevelopment) and [Twitter](https://twitter.com/nightwolfdev)!
---
Day 304 : In Tha Park
Tags: hiphop, code, coding, lifelongdev
Published: 2021-02-08 23:24:46

_liner notes_:
- Saturday : Spent the day working on coding for a project and getting some final work for the radio show done before the broadcast. Then it was time for the show. Had a really good time. The recording of this week's show is at https://kNOwBETTERHIPHOP.com

![Radio show episosde image of photos of Nujabes and J Dilla making music in their studios with the words Feb 6th 2021, Dillabes](https://dev-to-uploads.s3.amazonaws.com/i/qoygq2dwks40tovc1xxa.jpg)

- Sunday : Started the day finishing up post radio show promo work. Then found out that a link shortener I created stopped working because I used a version of Node that is no longer supported. I created the application like 5 years ago, I guess it was time. haha Upgrading some packages, redeployed the application, and everything started working. Awesome. Did some more coding and finally got a working demo of a project I've been working off and on for a minute. Basically, I wanted to figure out how I could upload a generated video that came from one place and upload to another. The final storage place's API documentation hasn't been updated in a few years and only had examples using CURL. After a bunch of trial and error, I finally got it working with JavaScript and the Fetch API. Super happy with getting it working. Did a little more coding and added some more functionality. When I was done, it was getting dark in the park. I left, got some food from Arby's and watched "The Watch" till I went to sleep. Pretty good day.  

- Professional : Got up a little earlier so I could get a jump on some work before doing the live stream show. Did the show, had a really good time. We got quite a bit done and had interactive viewers. After that, had a couple of meetings. Then I finally got my blog post submitted for review.

- Personal : So, it's been like a month and still no change on the items I ordered to build out my van. I know this have slowed down because of the pandemic, but it wasn't so slow that they withdrew the money from my account. haha I'm going to call them if I don't see any updates soon.

![View from a cave looking out to the ocean and mountains in Mallorca, Spain](https://dev-to-uploads.s3.amazonaws.com/i/duqtl8kg2zxa0ug31e7q.jpg)

Found out that another old application stopped working because of the Node version used to build it got deprecated. Thought it would go smoothly as the other application. Nope. I used TypeScript and apparently a lot of other things needed to be updated. It was a very small application the really didn't use too much TypeScript cause it wasn't that much to begin with. I just changed a couple of lines and took out the compilation step to make it regular JavaScript, updated some packages, redeployed and got it working again. Tonight, I'll probably plan out some slides I have to make for a presentation next week, eat my Arby's, watch "The Watch" (almost caught up), go through some tracks, maybe code, and go to sleep.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube gsUii_vp_bM %}
A Conversation About Imposter Syndrome
Tags: discuss, motivation, leadership, career
Published: 2021-02-08 23:20:54

The topic of **Imposter Syndrome**, especially as it relates to software engineering careers, is a prominent and repeated one. And for good reason, it's something many of us struggle with, some of us more than others.

###**Some Questions For You**
* How often do you deal with Imposter Syndrome?
* What tactics have you tried when dealing with it?
* What have you learned about how IS affect you?

**Share your answers in the comments section if u like** 🙂

###**A Recommendation**
I recently had a great conversation with [@_MarkSnyder_](https://twitter.com/_MarkSnyder_) on his podcast ***[Building Better Software Teams](https://7samurai.dev/podcast/bbst-episode-2-dealing-with-imposter-syndrome/)***. The topic was about Dealing with Imposter Syndrome.

**Give it a listen, let me know what you think.**
* [Play Now](https://7samurai.dev/podcast-download/313/bbst-episode-2-dealing-with-imposter-syndrome.mp3?ref=new_window)
* [Apple Podcasts](https://podcasts.apple.com/us/podcast/bbst-episode-2-dealing-imposter-syndrome-guest-ricardo/id1549568778?i=1000505859009)
* [Google Podcasts](https://podcasts.google.com/feed/aHR0cHM6Ly83c2FtdXJhaS5kZXYvZmVlZC9wb2RjYXN0/episode/aHR0cHM6Ly83c2FtdXJhaS5kZXYvP3Bvc3RfdHlwZT1wb2RjYXN0JnA9MzEz?sa=X&ved=0CAUQkfYCahcKEwigmsCfstvuAhUAAAAAHQAAAAAQAQ)
* [Spotify](https://open.spotify.com/episode/1GLq3xyn8vzREOuKHd75K1)

-----
I'll be tackling similar topics on my newsletter, **The Rising Dev** - [Subscribe Here](https://www.therisingdev.com/subscribe/).

*[Follow me on Twitter](https://twitter.com/RickLuevanos)*
Scraping Utah, Part 2
Tags: webscraping, axios, javascript, puppeteer
Published: 2021-05-27 19:24:02

---
title: Scraping Utah, Part 2
published: true
date: 2021-02-08 23:11:00 UTC
tags: WebScraping,Axios,Javascript,Puppeteer
canonical_url: https://javascriptwebscrapingguy.com/scraping-utah-part-2/?utm_source=rss&utm_medium=rss&utm_campaign=scraping-utah-part-2
---

The struggle with Utah secretary of state continues.

<iframe title="Scraping Utah Secretary of State. Part 2" width="640" height="360" src="https://www.youtube.com/embed/sOrxMwWUyD4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

And it seriously is a struggle. I’m having real concerns about the successful completion of this scrape.

2captcha continues to be a star, though. Here’s my affiliate link if you want a great captcha solver – https://2captcha.com?from=7390140

## Looking for business leads?

Using the techniques talked about here at [javascriptwebscrapingguy.com](https://javascriptwebscrapingguy.com), we’ve been able to launch a way to access awesome web data. Learn more at [Cobalt Intelligence](https://cobaltintelligence.com)!

The post [Scraping Utah, Part 2](https://javascriptwebscrapingguy.com/scraping-utah-part-2/) appeared first on [Javascript Web Scraping Guy](https://javascriptwebscrapingguy.com).
5 Great Ways To Learn Vue JS
Tags: vue, javascript, webdev, beginners
Published: 2021-02-08 23:02:28

# Hey Folks,

Made a short video on the ways I'm learning Vue JS. 

**Spoiler Alert:** "Dev.to" gets a mention! 

First of many (hopefully) for my YouTube channel "Take Coding". Check it out. 

Thanks

{% youtube OPiMJ787-c0 %}
Test Driven Development and Looping with map
Tags: javascript, codenewbie, beginners, webdev
Published: 2021-02-08 22:41:42

# **Terminology**

---

- **Test-Driven Development**: A workflow used by developers across coding languages. In TDD, we write tests that describe our application's behavior. Then we write the minimal amount of code we need to get the test passing. The goal is to break larger problems into more manageable steps and also to make sure our code is working correctly.
- **Tests**, **Specifications** or **Specs**: Examples of small, isolated behaviors a program should demonstrate, including input and output examples. Spec and test are interchangeable terms.

# **Example**

---

Here's an example of a pseudocoded test:

```
Describe: add()
Test: "It adds two numbers together and returns the sum"
Code: const sum = add(2,3);
Expect(sum).toEqual(5);
```

Here's what the same test would look like using Jest, the testing framework we'll be using in Intermediate JavaScript and beyond:

```jsx
describe('add()', () => {
  test('should correctly add two numbers together', () => {
    const sum = add(2,3);
    expect(sum).toEqual(5);
  });
});
```

# **Terminology**

---

- `Array.prototype.map()`: We can use this to loop over an array, creating a new array with transformed elements.

# **Example**

---

The following loops through each item in the `numbers` array, multiplies it by 2, and places it in a *new* array called `doubleNumbers`:

```jsx
const numbers = [1,2,3,4,5];
const doubledNumbers = numbers.map(function(number) {
  return number * 2;
});
```

Don't forget that you need to have a `return` statement - otherwise, `Array.prototype.map()` will return `undefined`.
Why the future of online education is live and social
Published: 2021-02-08 22:38:21

You were sick of looking for a technical co-founder for that startup idea. Or maybe you have been stuck in a job and an industry that you hate and you decided to learn how to code to work for a tech startup. 

We may have had different motivations for why we wanted to learn how to code, but most of us have ended up in this familiar situation, shortly thereafter: 

While the first couple of hours or even days of learning how to program were extremely exciting, we hit that wall where we can't simply copy and paste something that we read online and fix what's not working. We give up on the self-paced online course and start watching a bunch of YouTube tutorials -- to no avail. 

Most of us have already given up at this point. Some of us are lucky enough to have a friend or family member who can help us get "unstuck". Usually, even that person can't dedicate themselves to helping you get "unstuck" over and over again.

Today, online education falls broadly into one of the following two categories: 

1) Self-paced pre-recorded courses (i.e. MOOCs) such as Coursera, Udemy, etc.: these are basically glorified, multi-media versions of textbooks where engagement is low and it's easy to get stuck and lose motivation. 

2) Cohort-based live courses: these online courses are live and engaging with very low student-to-teacher ratios. However, they are priced accordingly and make the highly engaging learning format unattainable for most people. 

I believe there can and should be a third solution: scalable, social live education. In short? "Twitch for Education".

In college, I learned as much, if not more, from the students I was sitting next to as from the professor who was lecturing in front of me. What brought me back to each lecture was that social experience. And that's exactly what's missing online today. 

That's why I decided to hack together a product that addresses this very problem: 

Keat is a social learning platform where you can learn from the best and with the best. You can find study-buddies in the interactive live chat and ask your instructor questions during dedicated Q&A sessions. 

One of these teachers is Sailesh Kumar, a Senior Software Engineer at Facebook, who previously was an Adjunct Professor of Computer Science at GSU. Let's say, he talks the talk and walks the walk. And 200 of his students have already received job offers as software engineers. 

Sailesh will be going live tonight at 8 pm EST (5 pm PST) on Keat, teaching the Fundamentals of Programming. 

If you're interested to learn more about the curriculum and sign up, you can click on this link: https://keat.co/upcomingclass/fundamentals-of-programming-1612212653701x556236334813151200
React Create a New Component
Published: 2021-02-08 22:12:30

Continuing from the first post...

Open Visual Studio Code(VSC) to the same folder as before.

In the 'src' folder create a new file named:
 
```
helloMessage.js
```
Paste this code in:

```javascript
import React from 'react';
export default class HelloMessage 
  extends React.Component {
   render() {
     return 
   <div> 
      Hello 
      {this.props.name}
   </div>
  }
}
```
Don't forget the 'export default' bit.

Notice that in React, the render function contains HTML?  That's unique to React. This syntax is referred to as [JSX](https://reactjs.org/docs/introducing-jsx.html)   

JSX just works and probably has something to do with this code...

```javascript
extends React.Component
```
and that VSC shows no errors because [the TypeScript language service](https://code.visualstudio.com/docs/nodejs/reactjs-tutorial#_intellisense).

Finally the compiler named [Babel](https://babeljs.io/) allows the content above to be served as valid HTML.

**The Class Name**
The class name doubles as the new HTML tag name shown here:

```html
<HelloMessage 
    name="Test">
</HelloMessage>
```
But we can't use it prior to importing it into the component using it.  

```javascript
import { HelloMessage } 
  from "./helloMessage";
```
Notice the component name has a captial "H" and "M" but the file name has a lowercase "h". They can both be the same case. We pick the lower "h" for the filename to demark a file name from a component name. 

**Change the app.js file to look like this**

```javascript
import { HelloMessage } from "./helloMessage";
import "./App.css";

function App() {
  function test(){return `Time is: ${new Date().toTimeString()}`}
  function test2(){return `Seconds: ${new Date().getSeconds()}`}
  function test3(){return `MilliSeconds ${new Date().getMilliseconds()}`}
  return (
    <div>
      <HelloMessage name={test()}></HelloMessage>
      <HelloMessage name={test2()}></HelloMessage>
      <HelloMessage name={test3()}></HelloMessage>
      <HelloMessage name="Test3"></HelloMessage>  
    </div>
  );
}

export default App;
```
The code above shows how to combine JavaScript functions with the HTML. It's our first show of accessing JavaScript from HTML.  

**Learned**
- React uses the term 'component'

- Components inherit from React.Component via the extends keyword.

- The component name becomes the HTML tag name.

- To use a new component, it must be imported first. 

- JSX mixes both JavaScript and html

- File name and component name conventions are important.

This overall pattern of keeping components focused on one concern is the beauty of React. It simply fosters small reusable parts. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3bb6sk9rwsz8hglhl2yl.jpg)

**Note**
The backticks ` used above allow us to use [string interpolation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals). A very cool thing for putting live data inside a string.

JWP2021 React Components
Conditional Rendering in Vue
Tags: vue, beginners, webdev
Published: 2021-02-08 22:06:45

![Vue Logo with text Conditional rendering](https://dev-to-uploads.s3.amazonaws.com/i/f75ig8u57fbpeettnlet.jpeg)

Conditional rendering is a term to describe the ability to render different user interface (UI) markup depending on if a condition is true or false.

Conditional Rendering can be implemented in Vue using the directives below

<p class="list-item"> 💚 v-if</p>
<p class="list-item"> 💚 v-else</p>
<p class="list-item"> 💚 v-else-if</p>
<p class="list-item"> 💚 v-show</p>


<h3>v-if</h3>

The "v-if" directive can used to conditionally render an element including other elements that may be within it. The block will only be rendered if the directive’s expression returns a <a class="link" href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy" target="_blank">truthy value</a>.

Example

```html
<h1 v-if="showGreeting">Welcome Home!</h1>
```
Because "v-if" is a directive, it has to be attached to a single element. But what if we want to toggle more than one element?

You can also add conditional rendering to a group of elements by wrapping them in a "<template>" element as shown below

```html
<template v-if="Chores"> 🙃
    <h1>Chores</h1>
    <ul>
        <li>Wash the cat</li>
        <l1>Do the dishes</li>
    <ul>
</template>
```
"<template>" element serves as an invisible wrapper and will not be displayed in the final rendered result.

<h3>v-else</h3>

The "v-else" directive can only be used immediately after the "v-if" directive. They follow the pattern of a typical if-else statement.

The content within the "v-else" element will be rendered if the condition set in the "v-if" element is not met.

```html
<template v-if="Chores"> 🙃
    <h1>Chores</h1>
    <ul>
        <li>Wash the cat</li>
        <l1>Do the dishes</li>
    <ul>
</template>
<h1 v-else> Watch television</h1> 😀
```
<h3>v-else-if</h3>

The "v-else" element gives you only one other option to render if "v-if" element's condition is not met.

"v-else-if" serves as an else-if block for "v-if". It can also be chained multiple times so it enable you to have more than one option to render.

```html
<template v-if="Chores"> 🙃
    <h1>Chores</h1>
    <ul>
        <li>Wash the cat</li>
        <l1>Do the dishes</li>
    <ul>
</template>
<h1 v-else-if="Homework"> Do homework</h1>
<h1 v-else> Watch television</h1> 😀
```

<h3>v-show</h3>

"v-show" is very similar to "v-if"

The difference is that an element with "v-show" will always be rendered and remain in the DOM; "v-show" only toggles the display CSS property of the element.

"v-show" does not work in the "template" element nor does it work with "v-else".

"v-if" has higher toggle costs while "v-show" has higher initial render costs. So use "v-show" if you need to toggle something very often, and prefer "v-if" if the condition is unlikely to change at runtime.

You could support my work by sharing this article, thanks!

<a href="https://lindaojo.com/articles" target="_blank">Read more of my articles</a>
Basic Editor Working
Tags: projectupdate
Published: 2021-02-08 22:04:22

I didn't get an MVP built this month, like I had hoped to, but I did make a lot of progress. The screenplay editor is working with auto-formatting and the ability to collapse scenes (which is what I was working on when I gave up the original project).

I also have login with google working, and auto-saving screenplays to the cloud. My goals for this month are to get the index card view working, scene header navigation, add save/close buttons to the editor, collect title page information, finish document printing, then setup subscription payments and launch it.
Angular Problem
Published: 2021-02-08 21:43:03

hello guys I'm having issues with login with google authentication on my angular application.
what should I do any ideas?

this is my package.json file

"dependencies": {
"@angular/animations": "^11.1.2",
"@angular/cdk": "^11.1.1",
"@angular/common": "~11.1.2",
"@angular/compiler": "~11.1.2",
"@angular/core": "~11.1.2",
"@angular/fire": "^6.1.4",
"@angular/forms": "~11.1.2",
"@angular/material": "^11.1.1",
"@angular/platform-browser": "~11.1.2",
"@angular/platform-browser-dynamic": "~11.1.2",
"@angular/router": "~11.1.2",
"firebase": "^8.2.6",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1101.4",
"@angular/cli": "~11.1.4",
"@angular/compiler-cli": "~11.1.2",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.2.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.1.2"
}

below is my authservice.ts file

import { stringify } from '@angular/compiler/src/util';
import { Injectable } from '@angular/core';

import {AngularFireAuth} from '@angular/fire/auth';

@Injectable({
providedIn: 'root'
})
export class AuthService {

constructor(private login:AngularFireAuth ) { }
LoginWithGoogle()
{

this.login.signInWithRedirect()
}

}

I'm not getting any recommendation for the "auth" and I'm kind of confused.
is anything I need to change like the angular/fire version and firebase version? in other to get the "auth" for authentication
how can I solve this problem to get the "auth"
Processes?

before i saw it used to be like this.login.auth.SigninWithRedirect(new firebase.auth.Googleprovider())

Please, I need help with both the sign-in and signout implementation example as well

Thanks