AdmitadGoods plugin. About the plugin

The plugin is written using OOP, and almost everywhere the code that forms the layout (hereafter — views) is separated from the rest of the code (hereafter — software part).

AdmitadGoods plugin settings

1) Specify the token, choose the ad space you'll be using and save the changes

You will only be able to receive a token if:

а) A website-type ad space is added to;
b) You confirmed ownership of the ad space;
c) The ad space is approved by administration;
d) The ad space is joined with product offers (for people with product feeds).

2) Prefix for products in the URL
admitad_goods — the identifier that precedes the product's identifier

3) Prefix for categories in the URL
admitad_category — the identifier that precedes the identifier of your category

It is forbidden to use the following names in the prefixes of categories and products

These names are reserved for WordPress, and WordPress uses them all for its own purposes:

attachment, attachment_id, author, author_name, calendar, cat, category, category__and, category__in, category__not_in, category_name, comments_per_page, comments_popup, customize_messenger_channel, customized, cpage, day, debug, error, exact, feed, fields, hour, link_category, m, minute, monthnum, more, name, nav_menu, nonce, nopaging, offset, order, orderby, p, page, page_id, paged, pagename, pb, perm, post, post__in, post__not_in, post_format, post_mime_type, post_status, post_tag, post_type, posts, posts_per_archive_page, posts_per_page, preview, robots, s, search, second, sentence, showposts, static, subpost, subpost_id, tag, tag__and, tag__in, tag__not_in, tag_id, tag_slug__and, tag_slug__in, taxonomy, tb, term, theme, type, w, withcomments, withoutcomments, year,

4) Products deleted by an offer during an update

Choose what the plugin should do if the offer deleted previously uploaded products

deleted — products deleted by an offer will be removed from the showcase.
hidden — products deleted by an offer will remain in the showcase but won't appear on the site. The address of the hidden product will have 404 answer code from the server (specific to WordPress).
ignored — products deleted by an offer will remain in the showcase.

5) Perform search

Choose which search has a higher priority in your project. It is impossible to search through posts and products at the same time (specific to WordPress).

Attention! Once you change the prefix of products and/or categories, you should go to the page for configuring permanent links and click Save Changes; otherwise new links won't open. Just click the button.

How to get the English version of the plugin

In the WordPress system settings choose English (United States)

And you will thus change the plugin interface to English.

System requirements

PHP 5.4+, WordPress 4.4+, curl

Plugin installation

In order to install the plugin you must download it, open the list of the plugins on your site and install it. Learn more at the WordPress help center.

The main plugin files


The main plugin file. Connects all other files needed for the plugin to work. It also logs scripts and styles for the plugin, and contains functions for installing and deleting the plugin, and for displaying and operating the settings page.


A class for more convenient work with CURL used when connecting to the processed product feed server and Admitad.


A basic class containing general functions for connecting to third-party servers.


A class containing functions to work with the Admitad server.


A class responsible for connecting to the processed product server.


This file contains all the functions needed to process products on the database level (registering new types of posts and taxonomies, forming requests, receiving and updating specific product fields, etc.).


A class for working with advanced product attributes.


A class that expands the standard window of editing posts, complementing it with information about products, and adds filters in categories, etc., to the standard filters of the WordPress post list.


Responsible for importing products at all stages, except direct entry to the base (this is executed by GoodsDispatcher.php)


Responsible for inserting shortcodes into the editor (with the appropriate button).


A class responsible for product feed updates.


Work with plugin settings on the API WordPress level. Also contains default settings.


Ensures shortcode operation


A script for updating product feeds specified in the head.

Errors and solutions

product images not loaded. PHP Warning: file_get_contents():

The error occurs on VPS / VDS, check the error logs, if there are
PHP Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /home/login/.., then set allow_url_fopen=1 or seek support from the hosting provider

Cannot update plugin from the WordPress admin panel

The plugin is ~ 10 MB. in the archive. Importing such a file may require sufficient resources and if you can not update the plugin, the problem most likely lies in the setting up PHP

№1. Try to update the plugin AdmitadGoods not all plug-in at once, but only the one.

№2. Method №2. Perhaps during the upgrade plug-in hosting, there is timeout.

Try it in your .htaccess file (in the root of the site) to insert a line
php_value max_execution_time 100

.htaccess in the root of the site

Insert php_value max_execution_time 100

If the plugin is not renewed, and after that, it is necessary to write in support of the host and clarify whether they block the directive php_value max_execution_time in .htaccess, if so, should be asked to unlock and extend the load.

It does not work WP standard search on the site. Seeking only among the loaded goods

The plug-in settings, select the search option that you want and save the changes

Parse error: syntax error, unexpected T_FUNCTION in .../public_html/wp-content/plugins/admitad-goods/admitad-goods.php on line

Hosting does not meet the system requirements. System requirements

When you activate the plugin generates an error
Fatal error: Invalid opcode 153/1/8. in /wp-content/plugins/admitad-goods/widgets/widgets_all.php

The error occurs in consequence of the fact that eAccelerator (expansion to speed up PHP-code) is not compatible with the anonymous functions. Incompatibility appears on stage opcode optimization. Read more about the solution

The card offers
Fatal error: Call to undefined function mb_strpos() in /home/login/public_html/shop/wp-content/plugins/admitad-goods/GoodsAttributesManager.php on line 150

In PHP settings to include an extension mbstring. Contact your hosting provider, they will help to correct the error

curlErrorMessage => Protocol "https" not supported or disabled in libcurl

Admitad API Server is the protocol https. You, in the curl settings on the server, this protocol is not enabled. Protocols dict, file, ftp, gopher, http, imap, ldap, pop3, rtsp, smtp, telnet, tftp. As a result, there is an error curlErrorMessage => Protocol "https" not supported or disabled in libcurl. Contact your hosting provider, they will help to correct.

Fatal error: Call to undefined function get_the_post_thumbnail_url()

Update WordPress to the latest version and hosting must meet the system requirements. System requirements

Widget software part


Basic class for all widgets. Implements the function of separating files of the widget view from the software code, as well as the ability to create an alternative widget layout as part of the theme.


Software part of the category widget.


Software part of the filter widget.


Includes all widget files and registers them by hook

Widgets that are independent from the theme


Category widget (categories created for product feeds).


Filters. Every filter includes a secondary file, the name of which begins with two underlines.


Filter for prices (initially with a slider).


Filters for secondary attributes.


Filters for offers.


Filter for manufacturers.

Remove redundant attributes/properties of the product from widget

Our task: remove attributes/properties of the product from the widget.

1. In the standard plugin theme

In the file /wp-content/plugins/admitad-goods/themes/admitad2/admitad_widgets/__catAttr.php, where the admitad2 theme is used.

After the line <?php foreach ($catAttributes as $attr_id => $attr): ?> insert

if ($attr->name == 'category')

elseif($attr->name == 'subcategory')

elseif($attr->name == 'Other attribute')

With this method you specify the attributes you don't want to show in the widget.

Don't forget to move these changes to the child theme

2. In a non-standard plugin theme

Create a folder named admitad_widgets in the root of your theme.

Copy the file /wp-content/plugins/admitad-goods/views/widgets/__catAttr.php

After the line <?php foreach ($catAttributes as $attr_id => $attr): ?> insert

if ($attr->name == 'category')

elseif($attr->name == 'subcategory')

elseif($attr->name == 'Other attribute')

With this method you specify the attributes you don't want to show in the widget.

Alternative widget layouts

The layout of plugin widgets (product categories and filters) can be altered. Before you begin to use the default layout, the plugin looks for admitad_widgets in the current theme folder, and if it finds it and there is the required file, the layout from this file will be used, not the standard one. So if you don't like the standard widget layout, you can copy files from the wp-content/plugins/admitad-goods/views/widgets folder into the admitad_widgets folder of your theme and change the layout. But make sure to adhere to the following rules for the widgets to be able to work:

  • Don't remove or rename <input> used within widgets

  • Filters for manufacturers, stores and category attributes need to be checkboxes, so don't replace them for inputs of any other type. If you want colored checkboxes, you can make <input type=checkbox> with display: none;

  • The current "live" search in stores and categories is designed according to the existence of css-paths "#shops-names>li>label” and “vendor-names>li>label”, as well as input#vendor-search and input#shops-search

  • AJAX-filtration is triggered by a "change" event in the elements .adm-product-filter input[name]

In any event, the serious modification of widget layouts might require thorough knowledge of css, html, or even a partial/full rewrite of js-code filters. For example, we needed to make a small improvement in the admitad1 theme.

Shortcodes software part


Initial widgets layout. Not used by the plugin


product with a picture below


product with a picture on the left


product with a picture on the right


product with a picture above. Also returns product without text

Shortcode "See also"

"See also" — This is a functional that displays in the product card other goods of the same category.

In the card template (At the root of the file single-admitad_goods.php) of the product, enter the code:

<?php echo do_shortcode("[admitadCategoryGoods number=8]"); ?>

Where 8 is the number of output "Related products" (change to the one you need)

The shortcode pattern "See also" is located at

For him works functional of the child theme works in case you want to change its layout or appearance.

Shortcode “You interested”

"You interested" — This is a functional that displays in any site template the goods that the user watched and clicked on (each user is shown a personal list)

To work with a shortcode in any site template, enter the code:

<?php echo do_shortcode("[admitadInterest number=8]");?>			 

Where 8 is the number of output items (change to the one you need)

The shortcode template "You interested" is located at

For him works functional of the child theme works in case you want to change its layout or appearance.

"You interested" Can be displayed in posts and site pages

"You interested" Can be displayed in the posts and pages of the site, for this you need to use the line in the editor

[admitadInterest number=8]		 

Types of posts and taxonomies

Plugin registers a new type of a post: admitad_goods. Posts of this type are created during product feed imports. An admitad_category taxonomy type is also registered. If you're not using our themes, in order to return products and categories you must create corresponding files for the specific type of post and taxonomy. Details: WordPress template hierarchy

Output of product properties

Displays a list of products on the home page of your theme

<?php get_template_part("goods", "list"); ?>

If products were requested inside WordPress cycles, (i.e. posts like admitad_goods), the majority of product properties is available through a variable $post, as well as other standard properties of posts, such as$post->post_title;

Remember that WordPress cycles are used during the output of a separate post single.php, or if you created a special file for product output in the theme - single-admitad_goods.php, archive of posts category archive.php, archive-admitad_goods.php etc., see the WordPress templates hierarchy..

If you're using your own theme and you need to output products

If you AREN'T creating separate files (single-admitad_goods.php, archive-admitad_goods.php, etc.) for the output of a card or product list, you should use the following construction in your theme files

<?php if ($post->post_type === "admitad_goods"): ?>
here Product property
<?php endif; ?>  

Output of affiliate link

<?php if ($post->post_type === "admitad_goods"): ?>
<a href="<?php echo aurl($post->ID); ?>" target="_blank">Go to the product</a>
<?php endif; ?>  

Output of price and currency in a non-standard plugin theme

<?php if ($post->post_type === "admitad_goods"): ?>

<?php echo formatPrice($post->price, ",", " "); ?>
<?php echo $post->currencyId; ?>  

<?php endif; ?>

Product card

In the root of your theme create a file named single-admitad_goods.php

You can take the file from our default themes and edit it for your theme


Product categories

You must create two files taxonomy-admitad_category.php and goods-list.php in the root of your theme

You can take the file from our default themes and edit it for your theme


Filtering results

In the root of your theme create a file named archive-admitad_goods.php

You can take the file from our default themes or from the example above

Search results

In the root of your theme create a file namedsearch.php

You can take the file from our default themes or from the example above

These fields are added by the plugin to the standard fields of the post if the products and product categories (admitad_goods or admitad_category) were requested, and also during searches.

The fields will also be automatically added during the direct usage of the WP_Query class for the specified types of posts and taxonomies (admitad_goods, admitad_category, accordingly). So, which fields become available in addition


Product name. Written into the standard WordPress field for the post title


Product description. Written into the standard WordPress field for the post content


Product price


Price without discount. For products with no discount — 0


Product picture. Added as the thumbnail for a product post


Product manufacturer


Product model


Product URL


Product currency

In the variable $post you can find some other fields, but they only support the work of the plugin.

It's a little harder to work with product attributes such as color and size, and because they are different for different products and offers, it is impossible to import them into the $post variable. That is why you should use GoodsAttributesManager to work with them. Class is a singletone, so before you start working you should request its instance:

$ga = GoodsAttributesManager::instance()

Then you can request the attributes of the current product:

$attributes = $ga->getAttributes($post->id);

This will return the product attributes as an array of objects. The field "name" of every object will contain the attribute name (“color”, “size”, “diagonal”, etc.), and the "value" field — its value (“black", “12 inches”, etc.). Specific values depend on the product and vendor and can change.

Example of use:

<?php foreach(GoodsAttributesManager::instance()->getAttributes($post->ID) as $attr) {




              <?php echo $attr->name; ?>



              <?php echo $attr->value; ?>






Product request through WP_Query

Products can be requested manually, as can all other posts, using the standard WP_Query class. You can also use variables in requests by adding them directly to the class constructor:


Minimum price


Maximum price


Manufacturer name


Offer ID (can be retrieved from database)


Formally can be used in manual request builds, but it's too much effort in reality. But it's used automatically in filters

As we already mentioned, during requests through WP_Query additional fields are automatically downloaded from the corresponding tables, and are available through query->post or the global variable $post (depending on the method of operating the WP_Query object), as well as the standard post attributes.

For example,


$query = new WP_Query(array (

  "post_type" => "admitad_goods",

  "priceMin" => 10,

  "priceMax" => 30



To generate an affiliate link for the product, use the aurl() function:

<a href="<?php echo aurl($post->ID); ?>">Перейти на товар</a>

AJAX filters

If you want filters to work through AJAX, the container that has the content that should be updated through ajax must have the admitad-ajax-updated class. Typically, this is the container where products are transferred to.

Modification of the standard themes of the plugin

Create/edit your CSS in the child theme

Simple (not perfectly correct): create your header.php in the child theme and write the connection of style as usual. Low priority — for css to be the last on the list.

Difficult (but correct): create functions.php, capture the wp_enqueue_script hook in it with low priority (for example, 100) and connect the required script from there

The plugin delivery set includes 3 themes to help you make your WordPress blog an Internet showcase for collaborating with Admitad partners. They contain the basic functions we considered necessary for such sites, but we can't guess the desires of each and every last user. If you want to modify our theme, the best way to do this is to create a child WordPress theme that's based on it.

Why should you not modify the initial theme code?

We are currently developing our plugin, and its updates are available through the system of automatic WordPress updates. If you make edits directly in the theme code inside the plugin, every update will replace your edits for the standard theme code. The child theme code will remain unchanged. For detailed instructions on how to create child themes, see the WordPress documentation, as well as the sea of articles on the Internet, for example . You can find the initial code for our themes in the folder called wp-content/plugins/admitad-goods/themes, which is registered as one of the folders containing themes during the plugin's activation.

Let's say, for example, you want to edit the admitad3 theme. Оkay, so in the folder wp-content/themes ust create a new folder called, for example, admitad3-child, and put the file style.css there with the following content:


Theme Name:   Admitad3 Child

Template: admitad3


Now you can replace any file from our theme with your own. Just copy our file into your folder and make the necessary edits. There is also an alternative widget layout.

Description of the category after product list

Let's look at a real work example. Task:

Create a description of the categories after the product list where the changes won't be replaced by the standard files during the plugin update.

Now look at the second theme, which has the following address within the site root

We have a category description that has to be placed after the product list.

The code that displays the category description is in the file (as well as in other themes)

The code itself with commentary

So it's easy to notice that if you want the description to follow the list, you should replace the lines with code in the following way:

Then, in order to retain the changes during the plugin update, in the folder /wp-content/themes/ create a new folder called, for example, admitad2-child

Full path /wp-content/themes/admitad2-child/

And put the style.css file there with the following content:


Theme Name:   Admitad2 Child

Template: admitad2


In /wp-content/themes/admitad2-child/style.css

If you did everything as we described, in the section for choosing a theme there will be a new theme called Admitad2 Child

It must be activated.

Now you can replace any file from our theme with your own. Just copy our file to your folder /wp-content/themes/admitad2-child/ and make the necessary edits.

There is also an alternative widget layout.

Sliders and background images

You can change the slider in the file at the following address:

Theme 1 /wp-content/plugins/admitad-goods/themes/admitad1/front-page.php

Theme 2 /wp-content/plugins/admitad-goods/themes/admitad2/front-page.php

Theme 3 /wp-content/plugins/admitad-goods/themes/admitad3/front-page.php

All in One SEO Pack

If you want SEO settings to show when editing the product card and displaying product properties, in the plugin settings of the All in One SEO Pack enter the following into the header:

Now in Good Title format:

Apart from the standard properties provided by the plugin itself, the following are also available to you

In other words, to add titles in product cards you can create a construction out of product properties

%post_title% %vendor% %price% %currency% | %blog_title%

Available product properties

%post_title% Product name
%price% Price
%old_price% Old Price
%currency% Currency
%vendor% Manufacturer
%offer% Store (offer)
%model% Model

Technically speaking, you cannot display any other product properties (weight, size, diagonal, etc.); only the properties listed above.

Attention! If you're creating a product title manually, it will only change the product %post_title% name, while the other properties remain in the title.


Official plugin documentation

If you want the plugin WP-PageNavi to work in standard AdmitadGoods themes, you should put the following line into the file goods-list.php, which is in the theme root

<?php wp_pagenavi(); ?>

You can now delete the standard pagination code and leave just <?php wp_pagenavi(); ?>

You can also use the code in the taxonomy-admitad_category.php file, making the category description higher than pagination.

Don't forget to move these changes to the child theme.

Google XML Sitemaps

Plugin for creating the sitemap in XML.

Official plugin documentation

If you want the plugin to take into account the products and categories of the AdmitadGoods plugin, click the checkboxes in the plugin's settings

Shortcodes YouTube videos

Shortcodes YouTube videos are designed to quickly and easily search for videos on YouTube and place them on pages in the form of shortcodes.

Use video shorkody functionality for a variety of content on your site, make a useful and clear description of the site pages.

How to get the API Key YouTube

1. Go to page select the YouTube Data API

2. Create a project, give it a name

3. Activate

4. Go to the Credentials section of the drop-down list, select API Key

5. We get the key and can limit it

6. You can give it a name and save

The API key is unlimited. To prevent unauthorized use and theft of quotas, limit your key, or keep it in the safety of others.