Changeset 3479680
- Timestamp:
- 03/11/2026 03:52:15 AM (3 weeks ago)
- Location:
- rank-authority
- Files:
-
- 10 added
- 2 edited
-
tags/1.0.26 (added)
-
tags/1.0.26/assets (added)
-
tags/1.0.26/assets/icon.svg (added)
-
tags/1.0.26/rank-authority.php (added)
-
tags/1.0.26/readme.txt (added)
-
tags/1.0.26/templates (added)
-
tags/1.0.26/templates/category-geo.php (added)
-
tags/1.0.26/templates/page-geo.php (added)
-
tags/1.0.26/uninstall.php (added)
-
trunk/rank-authority.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/templates/page-geo.php (added)
Legend:
- Unmodified
- Added
- Removed
-
rank-authority/trunk/rank-authority.php
r3476655 r3479680 4 4 * Plugin URI: https://rankauthority.com/plugins/rankauthority 5 5 * 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.2 56 * Version: 1.0.26 7 7 * Author: Rank Authority 8 8 * Author URI: https://rankauthority.com … … 111 111 } 112 112 113 /** Use custom template for Geo category archive (no thumbnails) */113 /** Use custom template for Geo category archive or Geo pages (no thumbnails) */ 114 114 public function geo_category_template($template) { 115 115 if (is_category('geo')) { … … 117 117 if (file_exists($plugin_template)) { 118 118 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 } 119 129 } 120 130 } … … 1166 1176 } 1167 1177 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, 1171 1182 ]); 1172 1183 } … … 1432 1443 } 1433 1444 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 1434 1450 // Prepare post data 1435 1451 $post_data = [ … … 1437 1453 'post_content' => wp_kses_post($content), 1438 1454 'post_status' => $params['status'] ?? 'publish', 1439 'post_author' => 1 1455 'post_author' => 1, 1456 'post_type' => $is_geo ? 'page' : 'post', 1440 1457 ]; 1441 1458 … … 1445 1462 } 1446 1463 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'])) { 1449 1466 $post_data['post_date'] = sanitize_text_field($params['post_date']); 1450 1467 $post_data['post_date_gmt'] = get_gmt_from_date($params['post_date']); 1451 1468 } 1452 1469 1453 // Insert post 1470 // Insert post or page 1454 1471 $post_id = wp_insert_post($post_data); 1455 1472 … … 1471 1488 } 1472 1489 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'])) { 1475 1492 wp_set_post_categories($post_id, array_map('intval', $params['categories'])); 1476 1493 } 1477 1494 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'])) { 1480 1497 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); 1481 1503 } 1482 1504 … … 1685 1707 } 1686 1708 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'])) { 1689 1711 wp_set_post_categories($updated_id, array_map('intval', $params['categories'])); 1690 1712 } 1691 1713 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'])) { 1694 1716 wp_set_post_tags($updated_id, $params['tags']); 1695 1717 } -
rank-authority/trunk/readme.txt
r3476655 r3479680 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0.2 57 Stable tag: 1.0.26 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 137 137 138 138 == 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) 139 147 140 148 = 1.0.25 = … … 293 301 == Upgrade Notice == 294 302 303 = 1.0.26 = 304 GEO 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 295 306 = 1.0.24 = 296 307 Publisher 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.