More intitle all user posts previous. Search for words using additional operators. Go to publication

Surely you have heard more than once about such a wonderful search engine like Google. I suppose you've used it more than once when you wanted to know something. But did you find what you wanted? If you search Google for answers as often as I do, I think you will find this article helpful because it is designed to make your searches faster and more efficient. So, first, a little history ...

Google is a distorted spelling of the English word "googol", coined by Milton Sirotta, nephew of the American mathematician Edward Kaiser, to denote a number consisting of one and one hundred zeros. Now the name Google is the leader of Internet search engines, developed by Google Inc.

Google occupies more than 70% of the global market, which means that seven out of ten people on the Internet turn to its page in search of information on the Internet. It currently registers about 50 million search queries every day and indexes over 8 billion web pages. Google can find information in 101 languages. Google at the end of August 2004 consisted of 132 thousand machines located in different parts of the world.

Google uses intelligent text analysis technology to search for important yet relevant pages for your query. To do this, Google analyzes not only the page that matches the request, but also the pages that link to it in order to determine the value of this page for the purposes of your request. In addition, Google prefers pages where the keywords you entered are close to each other.

The Google interface contains a rather complex query language that allows you to restrict the search scope to specific domains, languages, file types, etc. The use of some operators of this language allows you to make the process of finding the necessary information more flexible and accurate. Let's consider some of them.

Logical "AND" (AND):
By default, when you write query words separated by a space, Google searches for documents containing all of the query words. This corresponds to the AND operator. Those. space is the same as AND operator.

For instance:
Cats dogs parrots zebras
Cats AND Dogs AND Parrots AND Zebras
(both requests are the same)

Logical "OR" (OR):
It is written using the OR operator. Note that the OR operator must be written in capital letters. Relatively recently, it became possible to write a logical "OR" in the form of a vertical bar (|), similar to how it is done in Yandex. Used to search with multiple options for the required information.

For instance:
Dachshunds long-haired OR smooth-haired
Long-haired dachshunds | smooth-haired
(both requests are the same)

Please remember that Google searches are not case sensitive! Those. Greenland and Greenland requests will be exactly the same.

Operator "Plus" (+):
There are situations when it is necessary to forcibly include in the text any word that may have spelling variations. To do this, use the "+" operator before the mandatory word. Suppose, if we have a request for House One I, as a result of the request we will have unnecessary information about “House One II”, “House One III” and quite a bit about “House One I”. If we have a request like Home Alone + I, the result will be information only about the movie “Home Alone I”.

For instance:
Newspaper + Zarya
Bernoulli equation + mathematics

Excluding words from the query. Logical "NOT" (-):
As you know, information garbage is often encountered when composing a request. To remove it, the standard exclusion operators are used - logical "NOT". Google represents such an operator with a minus sign. Using this operator, you can exclude from search results those pages that contain certain words in the text. Used like the + operator, before the excluded word.

For instance:
Crane well -bird
Dead Souls Novel

Finding the exact phrase (""):
In practice, searching for the exact phrase is required either to search for the text of a certain work, or to search for certain products or companies in which the name or part of the description is a stably repeating phrase. To cope with such a task using Google, you need to enclose the request in quotation marks (meaning double quotation marks, which are used, for example, to highlight direct speech).

For instance:
The work "Quiet Don"
"It was cold outside, although this did not prevent Boris from carrying out his plans."

By the way, Google allows you to enter no more than 32 words into the query line!

Truncate a word (*):
Sometimes it is required to search for information about a word combination of words in which one or more words are unknown. For this purpose, the "*" operator is used instead of unknown words. Those. "*" - any word or group of words.

For instance:
Master and *
Leonardo * Vinci

Cache operator:
The search engine stores the version of the text that is indexed by the search spider in a special store in a format called a cache. A cached version of a page can be retrieved if the original page is not available (for example, the server on which it is stored is down). The cached page is shown in the form in which it is stored in the database of the search engine and is accompanied by an inscription at the top of the page stating that it is a page from the cache. It also contains information about the creation time of the cached version. On the page from the cache, the query keywords are highlighted, and each word is highlighted with its own color for the convenience of the user. You can create a request that will immediately issue a cached version of a page with a specific address: cache: page_address, where instead of "page_address" is the address of the page stored in the cache. If you need to find any information in a cached page, you need to write a request for this information after the page address, separated by a space.

For instance:
cache: www.bsd.com
cache: www.knights.ru tournaments

It must be remembered that there should be no space between the ":" and the page address!

The filetype parameter:
As you know, Google indexes not only html pages. If, for example, you need to find some information in a file type other than html, you can use the filetype operator, which allows you to search for information in a specific file type (html, pdf, doc, rtf ...).

For instance:
Html filetype: pdf
Compositions filetype: rtf

Info statement:
The info statement allows you to see the information that Google knows about this page.

For instance:
info: www.wiches.ru
info: www.food.healthy.com

Site operator:
This operator restricts the search to a specific domain or site. That is, if you make a request: marketing intelligence site: www.acfor-tc.ru, then the results will be obtained from pages containing the words "marketing" and "intelligence" on the site "acfor-tc.ru", and not in others parts of the internet.

For instance:
Music site: www.music.su
Books site: ru

Link operator:
This operator allows you to see all pages that link to the page for which the request was made. So, requesting link: www.google.com will return pages that have links to google.com.

For instance:
link: www.ozone.com
Friends link: www.happylife.ru

Allintitle statement:
If you start a request with the allintitle operator, which translates as "everything in the title", then Google will return texts in which all the words of the request are contained in the titles (inside the TITLE tag in HTML).

For instance:
allintitle: Free software
allintitle: Download Music Albums

Intitle operator:
Shows pages in which only the word immediately after the intitle operator is contained in the heading, and all other query words can be anywhere in the text. Putting an intitle statement in front of each query word is equivalent to using the allintitle statement.

For instance:
Intitle programs: Download
intitle: Free intitle: download software

Allinurl operator:
If the request begins with the allinurl operator, then the search is limited to those documents in which all the words of the request are contained only in the page address, that is, in the url.

For instance:
allinurl: rus games
allinurl: books fantasy

Inurl operator:
The word that is located directly merged with the inurl operator will be found only in the address of the Internet page, and the rest of the words - anywhere on such a page.

For instance:
inurl: books download
inurl: games crack

Related statement:
This operator describes pages that "look like" to a particular page. So, a query related: www.google.com will return pages with topics similar to Google.

For instance:
related: www.ozone.com
related: www.nnm.ru

Define statement:
This operator acts as a kind of explanatory dictionary that allows you to quickly get the definition of the word that is entered after the operator.

For instance:
define: Kangaroo
define: Motherboard

Synonym search operator (~):
If you want to find texts containing not only your keywords, but also their synonyms, you can use the "~" operator before the word to which you want to find synonyms.

For instance:
Types ~ metamorphosis
~ Object orientation

Range operator (..):
For those who have to work with numbers, Google has made it possible to search for ranges between numbers. In order to find all pages containing numbers in a certain range "from - to", you need to put two dots (..) between these extreme values, that is, the range operator.

For instance:
Buy the book $ 100 .. $ 150
Population 1913..1935

Here are all the Google Query Language Operators I know. I hope they will somehow make it easier for you to find the information you need. In any case, I use them very often and I can say with confidence that when using them, I spend much less time searching than without them.

Good luck! And may the Force be with you.

Tags: search, operators, google

With that, in the Windows operating system, we figured it out last time.

In this post, we will deal with the folder structure in the user profile. This will allow us to understand the ideology of working with data, which is by default embedded in the Windows operating system.

Let me remind you that the profiles are in the folder Users Windows 7 (in the English version of Windows the folder is called Users) and in the folder Documents and Settings Windows XP.

When you go to the folder Users (Users) or Documents and Settings, then, probably, in addition to the folders with the names of the user accounts created on the computer, you will find the folder Are common... It contains settings that are the same for all computer users, as well as shared folders and files. In my observation, rarely anyone uses shared access to folders and files, so the folder Are common is practically of no interest to us.

After creating a user account on the computer, the profile folder is not yet created. It will appear later when you log into your computer under the newly created account. In this case, the name of the profile folder will always correspond to the name of the account, but there is one important point - the name of your account you will always can you change through the Control Panel, but the name of your profile folder will remain unchanged!

The set of folders inside the profile folder is the same for all users. It is created by default when you first log into the computer under a new account.

There is a special user profile template in the Windows operating system. It is he who is used by default when creating new accounts. But where is this template located?

It turns out that it is located in the same folder, but it is hidden from prying eyes.

To see the folder with the template, you need to enable the display of hidden and system files in Windows Explorer. This is done as follows - in Folder and search options program Explorer, you need to on the tab View uncheck the boxes opposite the items and Show hidden files and folders.

Hidden and system folders are now displayed in Explorer. Hidden folder icons are slightly blurred:

You can see that several new folders have appeared. In my case, these are folders “ All Users», « Default», « Default User"And" All users". Without going into details, I will say that the folders " Default User"And" All users"Are not folders in the usual sense of the word. These are a kind of shortcuts (links) that are created by the operating system automatically and they are intended for the compatibility of programs and different versions of the Windows operating system. In Windows 7, the same can be said about the folder “ Documents and Settings"Which is located at the root of the C: drive and is also hidden.

So, a new profile is created in the system based on the parameters and settings located in the folders “ Default”And“ All Users”. It is these folders that determine the default settings for new profiles, as well as the settings that are the same for all users of the computer.

Now let's go to any user's folder. Do you see that some folders have an arrow on their icons?

This icon indicates that this folder is a shortcut. Such shortcuts are also used to make the operating system compatible with programs.

Let's re-check the box next to Hide protected system files in Folder and search options Explorer programs. Now only the folders of interest to us will be displayed in Explorer.

First, I propose to sort out the folders that relate more to the information we store on the computer than to our account settings. So, in the screenshot below you can see how the user profile folders are linked to the elements of the Explorer window.

The user can store all personal information in his folders-libraries and this data will be available only to him. Other users will not have access to this information. As you now understand, the Explorer program displays the folders of your profile, respectively, and the information that you put in Libraries, for example, to the folder “ Video" or " Images"Will actually be stored in your profile at C: \\ Users \\ Username \\ My Videos or C: \\ Users \\ Username \\ Pictures.

The same goes for other items, such as the " Downloads"Or (folder" Search»).

By the way, please note that all the information (files and folders) that you store on your Desktop is located in the folder “ Desktop". You can easily verify this by looking in this folder. If you delete a file from it, it will disappear from the Desktop as well, and vice versa - the information copied into it will immediately appear on the Desktop.

So, we looked at the user profile folders that we deal with almost every day when working on a computer. There is one more very important folder, which is hidden by default - " AppData". This folder contains the basic settings for the Windows user interface and programs installed on the computer. I will talk about it in more detail in

And today I will tell you about another search engine that is used by pentesters / hackers - Google, more precisely about the hidden capabilities of Google.

What is Google Dorks?

Google Dork or Google Dork Queries (GDQ) are a set of queries to identify the grossest security holes. Anything that is not properly hidden from search engines.

For brevity, such requests are called Google Dorks, or simply Dorks, like those admins whose resources were hacked using GDQ.

Google operators

To begin with, I would like to provide a small list of useful Google commands. Among all the commands for advanced Google search, we are mainly interested in these four:

  • site - search for a specific site;
  • inurl - indicate that the search words should be part of the page / site address;
  • intitle - search operator in the title of the pages themselves;
  • ext or filetype - search for files of a specific type by extension.

Also, when creating a Dork, you need to know several important operators, which are set by special characters.

  • | - OR operator, or vertical slash (logical or) indicates that you need to display results containing at least one of the words listed in the query.
  • "" - the quotation mark operator indicates an exact match.
  • - - the minus operator is used to exclude from the output results with the words specified after the minus.
  • * - operator asterisk, or asterisk is used as a mask and means "anything".

Where to find Google Doors

The most interesting dorks are fresh, and the freshest are those that the pen tester found himself. However, if you get too carried away with experiments, you will be banned from Google ... until you enter the captcha.

If you don't have enough imagination, you can try to find fresh dorks on the net. The best site for finding dorks is Exploit-DB.

Exploit-DB online service is a non-profit project of Offensive Security. If anyone is not in the know, this company is engaged in training in the field of information security, and also provides pentesting (penetration testing) services.

The Exploit-DB database contains a huge number of dorks and vulnerabilities. To search for dorks, go to the site and go to the "Google Hacking Database" tab.

The base is updated daily. At the top, you can find the latest additions. On the left side is the date of adding the dork, title and category.


Exploit-DB website

At the bottom, you will find the doorways sorted by category.


Exploit-DB website
Exploit-DB website

Another good site is this. There you can often find interesting, new dorks that do not always end up on Exploit-DB.

Google Dorks use cases

Here are examples of dorks. When experimenting with dorks, don't forget the disclaimer!

This material is for informational purposes only. It is addressed to professionals in the field of information security and those who are going to become one. The information presented in the article is provided for informational purposes only. Neither the editors of the site www.site nor the author of the publication bear any responsibility for any harm caused by the material of this article.

Roads for finding site problems

Sometimes it is useful to examine the structure of a site by getting a list of files on it. If the site is built on the WordPress engine, then the repair.php file stores the names of other PHP scripts.

The inurl tag tells Google to search for the first word in the link body. If we wrote allinurl, then the search would occur throughout the body of the link, and the search results would be more cluttered. Therefore, it is enough to make a request like this:

inurl: /maint/repair.php? repair \u003d 1

As a result, you will receive a list of WP sites, whose structure can be viewed through repair.php.


Examining the structure of a WP site

A lot of problems for administrators are delivered by WordPress with unnoticed configuration errors. From the open log you can find out at least the names of scripts and downloaded files.

inurl: "wp-content / uploads / file-manager / log.txt"

In our experiment, the simplest request allowed us to find a direct link to the backup in the log and download it.


Finding valuable info in WP logs

A lot of valuable information can be extracted from the logs. It is enough to know how they look and how they differ from the mass of other files. For example, an open source database interface called pgAdmin creates a service file pgadmin.log. It often contains usernames, database column names, internal addresses, and the like.

The log is found by an elementary request:

ext: log inurl: "/ pgadmin"

It is believed that open source is secure code. However, in itself, the openness of the source means only the opportunity to research them, and the goals of such research are far from always good.

For example, Symfony Standard Edition is popular among web application development frameworks. When deployed, it automatically creates a parameters.yml file in the / app / config / directory, where it stores the name of the database, as well as the login and password.

You can find this file with the following query:

inurl: app / config / intext: parameters.yml intitle: index.of


f Another file with passwords

Of course, then the password could be changed, but most often it remains the same as it was set at the stage of deployment.

The open source UniFi API browser tool is increasingly used in the corporate environment. It is used to manage segments of wireless networks created on the principle of "seamless Wi-Fi". That is, in an enterprise network deployment scheme, in which multiple access points are controlled from a single controller.

The utility is designed to display data requested through the Ubiquiti's UniFi Controller API. With its help, it is easy to view statistics, information about connected clients and other information about the operation of the server through the UniFi API.

The developer honestly warns: “Please do keep in mind this tool exposes A LOT OF the information available in your controller, so you should somehow restrict access to it! There are no security controls built into the tool ... ". But many do not seem to take these warnings seriously.

Knowing about this feature and asking one more specific request, you will see a lot of service data, including application keys and passphrases.

inurl: "/ api / index.php" intitle: UniFi

General search rule: first, we define the most specific words that characterize the selected target. If it's a log file, what makes it different from other logs? If it is a file with passwords, where and in what form can they be stored? Bullet words are always found in a specific place - for example, in the header of a web page or its address. By limiting the scope of your search and setting precise markers, you will get raw search results. Then clean it of debris by specifying your request.

Open NAS search paths

Home and office NAS are popular these days. Many external drives and routers support the NAS function. Most of their owners do not bother with protection and do not even change the default passwords like admin / admin. You can find popular NAS by the typical titles of their web pages. For example, the request:

intitle: "Welcome to QNAP Turbo NAS"

will display a list of QNAP NAS IPs. All that remains is to find a weakly protected one among them.

The QNAP cloud service (like many others) has the function of providing file sharing through a closed link. The problem is, it’s not that private.

inurl: share.cgi? ssid \u003d


Finding shared files

This simple query shows files shared through the QNAP cloud. They can be viewed directly from the browser or downloaded for more detailed information.

Doors for searching IP cameras, media servers and web admin codes

In addition to NAS, advanced Google searches can find tons of other web-based network devices.

CGI scripting is most commonly used for this, so the main.cgi file is a promising target. However, he can meet anywhere, so it is better to clarify the request.

For example, adding a typical call to it? Next_file. As a result, we get a dork of the form:

inurl: "img / main.cgi? next_file"

In addition to cameras, there are media servers in a similar way, open to everyone. This is especially true for Twonky servers manufactured by Lynx Technology. They have a very recognizable name and a default port of 9000.

For cleaner search results, it is better to include the port number in the URL and exclude it from the text portion of web pages. The request takes the form

intitle: "twonky server" inurl: "9000" -intext: "9000"


Video library by years

Typically a Twonky server is a huge media library sharing content over UPnP. Authorization for them is often disabled "for convenience".

Roads for finding vulnerabilities

Big data is all the rage right now: it is believed that adding Big Data to anything will magically work better. In reality, there are very few real specialists on this topic, and with the default configuration, big data leads to large vulnerabilities.

Hadoop is one of the simplest ways to compromise tera and even petabytes of data. This open source platform contains well-known headers, port numbers, and service pages that make it easy to find the nodes it controls.

intitle: "Namenode information" AND inurl: ": 50070 / dfshealth.html"


Big Data? Big vulnerabilities!

With such a concatenated query, we get search results with a list of vulnerable systems based on Hadoop. You can browse the HDFS file system directly from your browser and download any file.

Google Doors is a powerful tool for any pentester that not only an information security specialist, but also an ordinary network user should know about.

A query language is an artificially created programming language used to make queries against databases and information systems.

In general, these query methods can be classified according to whether they are for a database or for information retrieval. The difference is that requests to such services are made to obtain actual answers to the questions posed, while the search engine tries to find documents containing information related to the area of \u200b\u200binterest to the user.

Database

Database query languages \u200b\u200binclude the following examples:

  • QL - Object Oriented, refers to the successor to Datalog.
  • Contextual (CQL) is a formal query language for information retrieval systems (such as web indexes or bibliographic catalogs).
  • CQLF (CODYASYL) - for CODASYL-TYPE databases.
  • Concept Oriented Query Language (COQL) - used in related models (com). It is based on construpt data modeling principles and uses operations such as projection and de-projection of multivariate analysis, analytic operations and inference.
  • DMX - used for models
  • Datalog is a deductive database query language.
  • Gellish English is a language that can be used to query the Gellish English databases and allow for dialogues (requests and responses) and knowledge information modeling.
  • HTSQL - Translates http queries to SQL.
  • ISBL - Used for PRTV (one of the first relational database management systems).
  • LDAP is a protocol for queries and directory services over TCP / IP.
  • MDX - Required for OLAP databases.

Search engines

The search query language, in turn, is aimed at finding data in search engines. It differs in that often queries contain plain text or hypertext with additional syntax (for example, "and" / "or"). It differs significantly from standard similar languages, which are governed by strict command syntax rules or contain positional parameters.

How are search terms classified?

There are three broad categories that cover most searches: informational, navigation, and transactional. Although this classification has not been established theoretically, it is empirically supported by actual searches on search engines.

Info queries are those that cover broad topics (such as a particular city or truck model) for which thousands of relevant results can be obtained.

Navigation queries are queries that search for a single site or web page on a specific topic (e.g. YouTube).

Transactional - reflect the user's intention to perform a certain action, for example, to make a purchase of a car or book a ticket.

Search engines often support a fourth type of query, which is much less frequently used. These are so-called connection requests that report the connectivity of the indexed web graphics (the number of links to a specific URL, or how many pages are indexed from a specific domain).

How is information retrieval done?

Interesting characteristics regarding web search have become known:

The average search query length was 2.4 words.

  • About half of users submitted one request, and just under a third of users made three or more unique requests one by one.
  • Nearly half of the users viewed only the first page or two of the results.
  • Less than 5% of users use advanced search capabilities (for example, selecting specific categories or searching in a search).

Features of custom actions

The study also found that 19% of searches contained a geographic term (e.g., names, postal codes, geographic features, etc.). It is also worth noting that in addition to short queries (that is, with several conditions), there were often predictable patterns by which users changed their search phrases.

It was also found that 33% of requests from one user are repeated, and in 87% of cases the user will click on the same result. This suggests that many users use repeated queries to revise or re-find information.

Frequency distributions of requests

In addition, experts have confirmed that the frequency distributions of requests correspond to the power law. That is, a small part of the keywords is observed in the largest list of queries (for example, over 100 million), and they are the most frequently used. The rest of the phrases within the same topics are used less often and more individually. Called the Pareto Principle (or the 80-20 Rule), this phenomenon has allowed search engines to use optimization techniques such as indexing or database partitioning, caching and prefetching, and it has also made it possible to improve the search engine query language.

In recent years, it has been found that the average query length has been growing steadily over time. So, the average query in English has become longer. In this regard, Google has implemented an update called "Hummingbird" (in August 2013), which is able to handle long search phrases with non-protocol, "spoken" query language (like "where is the nearest coffee shop?").

For longer queries, their processing is used - they are divided into phrases formulated in a standard language, and the answers are displayed in different parts separately.

Structured queries

Search engines that support both syntax use more advanced query languages. A user who is looking for documents covering several topics or facets can describe each of them according to the logical characteristic of the word. At its core, a logical query language is a collection of certain phrases and punctuation marks.

What is advanced search?

The query language of "Yandex" and "Google" is capable of performing a more narrowly targeted search if certain conditions are met. Advanced searches can search by part of a page title or title prefix, as well as specific categories and lists of names. It can also limit searches to pages that contain specific words in the title or are in specific subject groups. If used correctly, the query language can handle parameters that are orders of magnitude more complex than the surface results of most search engines, including user-supplied words with variable ending and similar spellings. When presented with advanced search results, a link to the relevant sections of the page will be displayed.

It is also the ability to search all pages containing a specific phrase, while with a standard query, search engines cannot stop at any discussion page. In many cases, the query language can lead to any page located in the noindex tags.

In some cases, a well-formed query allows you to find information containing a number of special characters and letters of other alphabets (Chinese characters for example).

How are query language characters read?

Upper and lower case, as well as some (umlauts and accents) are not counted in searches. For example, a search for the keyword Citroen will not find pages containing the word Citroen. But some ligatures correspond to individual letters. For example, a search for the word "aeroscobing" will easily find pages that contain "Ereskebing" (AE \u003d Æ).

Many non-alphanumeric characters are routinely ignored. For example, you cannot find information for a query containing the string | L | (a letter between two vertical stripes), even though this character is used in some conversion templates. The results will contain only data with "LT". Certain characters and phrases are handled differently: the query "loan (Finance)" will display articles with the words "loan" and "finance", ignoring the parentheses, even if there is an article with the exact name "loan (Finance)".

There are many functions that can be used with the query language.

Syntax

The query language of Yandex and Google may use some punctuation marks to refine the search. An example is curly braces - ((search)). The phrase enclosed in them will be searched as a whole, without changes.

The phrase в allows you to determine the object of the search. For example, a word in quotation marks will be recognized as used in a figurative sense or as a fictional character, without quotation marks - as information of a more documentary nature.

In addition, all major search engines support the "-" character for the logical "not" and and / or. An exception is terms that cannot be prefixed with a hyphen or dash.

An inaccurate search phrase is marked with ~. For example, if you do not remember the exact wording of a term or name, you can enter it in the search bar with the specified symbol, and you can get the results that have the maximum similarity.

Custom search options

There are also search parameters such as intitle and incategory. They are colon-separated filters in the form filter: query string. The query string can contain the search term or phrase, or part or full page title.

The function "intitle: query" gives priority in search results by title, but also shows regular results by title content. Several of these filters can be used simultaneously. How do you use this opportunity?

A query like "intitle: airport name" will return all articles containing the name of the airport in the header. If you formulate it as "parking intitle: the name of the airport", then you will receive articles with the name of the airport in the title and with the mention of parking in the text.

Search by filter "incategory: Category" works on the principle of initial results of articles belonging to a certain group or list of pages. For example, a search query like "Temples incategory: History" will return results about the history of temples. This function can also be used as an advanced function by setting various parameters.

In the article about I reviewed examples and codes for displaying some additional information elements on post pages: coherent notes, tag / category names, etc. Links to previous and next WordPress posts are a similar feature. These links will be useful for navigating site visitors, and are also another way. That is why I try to add them to each of my projects.

In the implementation of the task, 4 functions will help us, which I will discuss below:

Since we are talking about the posts page (Post), in 99% of cases you will need to edit the template file single.php (or the one where the output format for single articles is set in your theme). The functions are used in the Loop. If you need to remove the next / previous posts in WordPress, then look for the corresponding code in the same template file and delete (or comment out) it.

Next_post_link function

By default, a link is formed to a note that has a newer creation date immediately after the current one (since all posts are arranged in chronological order). This is how it looks in the code and on the website:

Function syntax:

  • format (string) - defines the general format of the generated link, where using the% link variable you can set some text before and after it. By default, it's just a link with an arrow: ‘% link’ ’
  • link (string) - anchor of the link to the next post in WordPress, the% title parameter substitutes its title.
  • in_same_term (boolean) - determines whether only elements from the current category will be considered in the work. Valid values \u200b\u200bare true / false (1/0), the default is the second option.
  • excluded_terms (string or array) - specify the ID of the blog categories, the notes from which will be excluded from the selection. Either array is allowed array (2, 5, 4) or writing to a string separated by commas. Useful when working with GoGetLinks, when you need to prohibit the display of advertising posts in a given block.
  • taxonomy (string) - contains the name of the taxonomy from which the following entries are taken, if the variable $ in_same_term \u003d true.

Judging from the screenshot above, it is clear that all of these parameters are optional. Here's an example of using the function on one of my sites:

(next article) % link → ","% title ", FALSE, 152)?\u003e

Here I set my own format for displaying the link + exclude from the selection all elements belonging to the section ID \u003d 152.

If you need to display the next post from the same category in WordPress, then the code below will come in handy (this ignores the ID \u003d 33 section):

When you want to work only with the current specific taxonomy, specify its name in the parameters (for example, testimonial):

\u003e ", TRUE," "," testimonial ");?\u003e

Previous_post_link function

Working with previous WordPress posts is the same as above, as is the syntax. Looks like that:

Relevant code:

  • format (string) - sets the format the% link variable is responsible for (add text / tags before and after it). The default is ‘“% link ’.
  • link (string) - anchor of the link, to insert a title write% title.
  • in_same_term (boolean) - if true, then only objects from the same blog section will be displayed.
  • excluded_terms - remove unnecessary categories, specify ID separated by commas (as a string) or as an array.
  • taxonomy (string) - Defines the taxonomy of fetching the previous post in WordPress, if the $ in_same_term parameter is active.

In one of the blogs I use:

% link", "<< Предыдущая", TRUE, "33"); ?>

Here we make a bold font + instead of the element title, a certain phrase is written (although it is better to use a title in the linking). Only objects of the current category are displayed, except for the one with ID \u003d 33.

The_post_navigation function

This solution combines both links to previous and next WordPress posts. This is done for convenience, replaces the call of two functions with one. If you need to output HTML code without displaying, use get_the_post_navigation ().

The the_post_navigation syntax is as simple as possible:

Where $ args is a collection of different optional parameters:

  • $ prev_text - anchor of the previous link (by default% title).
  • $ next_text - similarly to the link text but to the next post (initially% title).
  • $ in_same_term (true / false) - allows to show articles only from the current taxonomy.
  • $ excluded_terms - excluded IDs separated by commas.
  • $ taxonomy - the name of the taxonomy for the selection, if in_same_term \u003d true.
  • $ screen_reader_text - the title of the entire block (by default - Post navigation).

Thus, we see that there are the same variables here as in the previous "single" functions previous_post_link, next_post_link: anchors, sampling by taxonomies, etc. Using a solution will just make your code more compact, and it doesn't make sense to repeat the same parameters twice.

Let's consider the simplest situation when you need to display elements from the same category:

"next:% title", "next_text" \u003d\u003e "previous:% title", "in_same_term" \u003d\u003e true, "taxonomy" \u003d\u003e "category", "screen_reader_text" \u003d\u003e "Read more",)); ?\u003e

Posts_nav_link function

If I understand correctly, then it can be used not only for displaying in a single post, but also in categories, notes by month, etc. That is, in single.php it will be responsible for links to previous / next WordPress articles, and in archives - for page navigation.

The syntax for posts_nav_link is:

  • $ sep - separator displayed between links (before it was ::, now -).
  • $ prelabel - link text of previous elements (by default: “Previous Page).
  • $ nxtlabel - text for the next page / posts (Next Page ").

Here's an interesting example with pictures instead of text links:

" , "" ) ; ?>

", ""); ?>

Just don't forget to upload images prev-img.png and next-img.png to directory images in your . I think other HTML code is added in the same way, if, for example, you need to use some DIV or class when aligning.

Total. There are also a few other miscellaneous features on the navigation that you can find in the codex. I hope this is more or less clear. As for posts_nav_link, to be honest, I'm not sure if it allows you to display the previous and next posts on a single page, because not tested, although the description mentions it. I think in this case it is more efficient and desirable to use the_post_navigation, which is newer and with a much larger number of parameters.

If you have any questions about navigation between posts or additions, write below.

Did you like the article? To share with friends: