Plugin Directory

Changeset 3479680


Ignore:
Timestamp:
03/11/2026 03:52:15 AM (3 weeks ago)
Author:
rankauthority
Message:

Version 1.0.26 - GEO drops into pages section

Location:
rank-authority
Files:
10 added
2 edited

Legend:

Unmodified
Added
Removed
  • rank-authority/trunk/rank-authority.php

    r3476655 r3479680  
    44 * Plugin URI: https://rankauthority.com/plugins/rankauthority
    55 * Description: Secure API connector to publish posts / overwrite posts from the RA Dashboard to WordPress. Token reset now available to all administrators.
    6  * Version: 1.0.25
     6 * Version: 1.0.26
    77 * Author: Rank Authority
    88 * Author URI: https://rankauthority.com
     
    111111    }
    112112
    113     /** Use custom template for Geo category archive (no thumbnails) */
     113    /** Use custom template for Geo category archive or Geo pages (no thumbnails) */
    114114    public function geo_category_template($template) {
    115115        if (is_category('geo')) {
     
    117117            if (file_exists($plugin_template)) {
    118118                return $plugin_template;
     119            }
     120        }
     121        // Single Geo page (GEO content published as pages)
     122        if (is_singular('page')) {
     123            $page_id = get_queried_object_id();
     124            if ($page_id && get_post_meta($page_id, '_rank_authority_geo', true)) {
     125                $page_template = plugin_dir_path(__FILE__) . 'templates/page-geo.php';
     126                if (file_exists($page_template)) {
     127                    return $page_template;
     128                }
    119129            }
    120130        }
     
    11661176        }
    11671177        return rest_ensure_response([
    1168             'category_id' => $id ? (int) $id : null,
    1169             'slug' => 'geo',
    1170             'name' => 'Geo',
     1178            'category_id'       => $id ? (int) $id : null,
     1179            'slug'             => 'geo',
     1180            'name'             => 'Geo',
     1181            'publish_as_page'   => true,
    11711182        ]);
    11721183    }
     
    14321443        }
    14331444
     1445        // GEO content is published as pages (not posts)
     1446        $geo_id = get_option($this->option_geo_category_id) ?: $this->ensure_geo_category();
     1447        $is_geo = !empty($params['is_geo'])
     1448            || ($geo_id && !empty($params['categories']) && in_array((int) $geo_id, array_map('intval', (array) $params['categories']), true));
     1449
    14341450        // Prepare post data
    14351451        $post_data = [
     
    14371453            'post_content' => wp_kses_post($content),
    14381454            'post_status'  => $params['status'] ?? 'publish',
    1439             'post_author'  => 1
     1455            'post_author'  => 1,
     1456            'post_type'    => $is_geo ? 'page' : 'post',
    14401457        ];
    14411458
     
    14451462        }
    14461463
    1447         // Add post date if provided (for scheduling)
    1448         if (!empty($params['post_date'])) {
     1464        // Add post date if provided (for scheduling) - posts only; pages typically don't use dates
     1465        if (!$is_geo && !empty($params['post_date'])) {
    14491466            $post_data['post_date'] = sanitize_text_field($params['post_date']);
    14501467            $post_data['post_date_gmt'] = get_gmt_from_date($params['post_date']);
    14511468        }
    14521469
    1453         // Insert post
     1470        // Insert post or page
    14541471        $post_id = wp_insert_post($post_data);
    14551472
     
    14711488        }
    14721489
    1473         // Set categories if provided
    1474         if (!empty($params['categories']) && is_array($params['categories'])) {
     1490        // Set categories if provided (posts only; pages do not support categories)
     1491        if (!$is_geo && !empty($params['categories']) && is_array($params['categories'])) {
    14751492            wp_set_post_categories($post_id, array_map('intval', $params['categories']));
    14761493        }
    14771494
    1478         // Set tags if provided
    1479         if (!empty($params['tags']) && is_array($params['tags'])) {
     1495        // Set tags if provided (posts only; pages do not support tags by default)
     1496        if (!$is_geo && !empty($params['tags']) && is_array($params['tags'])) {
    14801497            wp_set_post_tags($post_id, $params['tags']);
     1498        }
     1499
     1500        // Mark GEO pages for template/identification
     1501        if ($is_geo) {
     1502            update_post_meta($post_id, '_rank_authority_geo', 1);
    14811503        }
    14821504
     
    16851707        }
    16861708
    1687         // Update categories if provided
    1688         if (!empty($params['categories']) && is_array($params['categories'])) {
     1709        // Update categories if provided (posts only; pages do not support categories)
     1710        if ($post->post_type === 'post' && !empty($params['categories']) && is_array($params['categories'])) {
    16891711            wp_set_post_categories($updated_id, array_map('intval', $params['categories']));
    16901712        }
    16911713
    1692         // Update tags if provided
    1693         if (!empty($params['tags']) && is_array($params['tags'])) {
     1714        // Update tags if provided (posts only; pages do not support tags by default)
     1715        if ($post->post_type === 'post' && !empty($params['tags']) && is_array($params['tags'])) {
    16941716            wp_set_post_tags($updated_id, $params['tags']);
    16951717        }
  • rank-authority/trunk/readme.txt

    r3476655 r3479680  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.0.25
     7Stable tag: 1.0.26
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    137137
    138138== Changelog ==
     139
     140= 1.0.26 =
     141* GEO content now published as WordPress pages instead of posts
     142* Use `is_geo: true` or include Geo category ID in `categories` to publish as page
     143* GET /ra/v1/geo-category now returns `publish_as_page: true` for Dashboard compatibility
     144* Added templates/page-geo.php for GEO page display (text-focused, no thumbnails)
     145* Geo pages marked with _rank_authority_geo meta for identification
     146* Delete endpoint works for both posts and pages (unchanged behavior)
    139147
    140148= 1.0.25 =
     
    293301== Upgrade Notice ==
    294302
     303= 1.0.26 =
     304GEO content is now published as WordPress pages instead of posts. Use `is_geo: true` or include Geo category ID in the publish request. Existing geo posts remain unchanged; new GEO content will appear under Pages.
     305
    295306= 1.0.24 =
    296307Publisher logo dimensions now conform to Google's 600px max width guideline. Fixes Search Console structured data validation warnings.
Note: See TracChangeset for help on using the changeset viewer.