=== Haghs Preferred Source Button for Google ===
Contributors: haghs
Donate link: https://wordtune.me
Tags: google, preferred sources, seo, button, shortcode
Requires at least: 5.9
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a lightweight, customizable "Add as Preferred Source" button (Google's Preferred Sources feature) to your posts, pages, and custom post types.

== Description ==

**Haghs Preferred Source Button for Google** lets your visitors add your site — or the exact post/page they're reading — to their Google Preferred Sources with a single click, using Google's official `google.com/preferences/source` link format. No API keys, no OAuth, no tracking scripts. Just a fast, simple button.

This plugin is developed independently by Benjamin Hagh Parast and is not affiliated with, endorsed by, or sponsored by Google. "Google" and "Preferred Sources" are referenced only to describe the feature this plugin links to.

= Features =

* Fully customizable button text
* Choose where the button appears automatically: Header, Footer, Before Content, After Content, Navigation Menu, Floating Left, or Floating Right
* Show the button on any public post type - Posts, Pages, or any custom post type registered by your theme or other plugins - defaults to Posts only, since blog content usually carries the repeat-visit value
* Uses the exact permalink of the post/page being viewed, so visitors prefer the specific content they found, not just your homepage
* `[hpsbg_button]` shortcode for manual placement anywhere, with optional `text` and `url` overrides
* Open link in a new tab (optional)
* Built-in guidance in the settings screen on Google's Preferred Sources eligibility requirements, with links to check your own domain and to Google's official documentation
* Clean uninstall — removes its single settings option, no leftover data
* No external libraries, no database tables, minimal CSS footprint

= About Google Preferred Sources =

Preferred Sources is a feature from Google that lets people choose the sites they want to see more of in Top Stories, AI Overviews, and other personalized search surfaces. There is no submission or application process — Google determines eligibility automatically by crawling and evaluating a site. Only domain-level or subdomain-level sites are eligible (a subdirectory such as `example.com/blog` never qualifies on its own), and eligibility is generally tied to publishing fresh, regular content that Google would also consider for Top Stories.

You can check whether your own domain is currently eligible at [google.com/preferences/source](https://www.google.com/preferences/source), and read Google's own guidance at [Google Search Central's Preferred Sources documentation](https://developers.google.com/search/docs/appearance/preferred-sources). This plugin's settings screen links to both, since the button itself is only useful once your site already qualifies — it cannot make an ineligible site eligible.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/haghs-preferred-source-button-for-google` directory, or install the plugin through the WordPress Plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Go to **Settings → Preferred Source Button** to configure the button text and placement, and to check your Google eligibility.
4. Optionally use the `[hpsbg_button]` shortcode anywhere you want manual placement.

== Frequently Asked Questions ==

= Does this plugin use any Google API or require an API key? =

No. It links directly to Google's public preferences URL. No keys, no authentication, no tracking.

= Will it show my homepage or the specific post URL? =

When a visitor is viewing a single post or page, the button uses that exact page's URL. The "Fallback URL" setting is only used in contexts without a single post/page in view (e.g. archive pages or the navigation menu).

= Can I control where the button shows? =

Yes — under Settings → Preferred Source Button, choose Header, Footer, Before Content, After Content, Navigation Menu, Floating Left, Floating Right, or disable automatic placement and use the shortcode only.

= Can I show it only on blog posts and not static pages? =

Yes. By default the button only shows on Posts. The "Show On" list includes every public post type on your site (Posts, Pages, and any custom post types like Portfolio, Products, etc.) so you can pick exactly which content types get the button.

= My site doesn't appear in Google's preferences tool - why? =

That's a Google eligibility decision, not something this plugin controls. See the "About Google Preferred Sources" section above, and the link to Google's own documentation in the plugin's settings screen.

= Is this plugin affiliated with Google? =

No. It is an independent, unofficial tool that links to a publicly available Google URL. "Google" and "Preferred Sources" are used descriptively only.

== Screenshots ==

1. Settings screen with button text, placement, post type, and eligibility guidance.
2. Example of the button rendered after post content.

== Changelog ==

= 1.2.0 =
* Renamed plugin and slug to avoid trademark/naming confusion
* Prefixed all functions, classes, options, constants, and the shortcode tag with `hpsbg`/`HPSBG` to avoid collisions
* Added an eligibility information section to the settings screen, with links to check your domain and to Google's official documentation

= 1.1.0 =
* "Show On" now lists every public post type (not just Posts/Pages), including custom post types
* Default changed to Posts only, since blog content is usually where repeat-visit value lives

= 1.0.0 =
* Initial release: customizable button text, placement options, post type targeting, per-post permalink targeting, and shortcode support.

== Upgrade Notice ==

= 1.2.0 =
Plugin renamed. If upgrading manually from an older unpublished build, re-check your settings after updating, as the shortcode tag also changed from [add_as_preferred_google] to [hpsbg_button].

= 1.0.0 =
Initial release.
