Plugin Directory

Changeset 2235501


Ignore:
Timestamp:
01/29/2020 10:53:23 PM (6 years ago)
Author:
xcf33
Message:

provide the ability to deploy lndr page to wordpress front page

Location:
lndr-page-builder/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lndr-page-builder/trunk/README.txt

    r1768535 r2235501  
    55Requires at least: 4.7
    66Tested up to: 4.8
    7 Stable tag: 1.1
     7Stable tag: 1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3939https://wordpress.org/plugins/debug-bar/ (For general debugging)
    4040
    41 = I have everything setup correctly, however my page is not being imported into WordPress = 
     41= I have everything setup correctly, however my page is not being imported into WordPress =
    4242
    4343If you do not see Lndr page published on your wordpress website. It might be because of the WordPress Cron (WP) cron and due to low traffic volume. For example, for WordPress sites hosted on WP engine, see https://wpengine.com/support/wp-cron-wordpress-scheduling/, by contacting support and enable "alternate cron" will resolve the issue
     
    57571.0 Fully working version
    58581.1 Added instant publishing feature
     591.2 Added publish add root domain (using keyword lndr-frontpage)
    5960
    6061== Upgrade notice ==
  • lndr-page-builder/trunk/includes/class-lndr.php

    r1768535 r2235501  
    7070
    7171        $this->plugin_name = 'Lndr';
    72         $this->version = '1.1';
     72        $this->version = '1.2';
    7373
    7474        $this->load_dependencies();
     
    164164        $plugin_public = new Lndr_Public( $this->get_plugin_name(), $this->get_version());
    165165    $this->loader->add_filter('page_template', $plugin_public, 'lndr_page_template');
     166        $this->loader->add_filter( 'frontpage_template', $plugin_public, 'lndr_page_template' );
    166167    $this->loader->add_action('rest_api_init', $plugin_public, 'service_routes');
    167168    // $this->loader->add_action('init', $plugin_public, 'rewrite_api_route');
  • lndr-page-builder/trunk/lndr.php

    r1768535 r2235501  
    44Description: This plugin allows you to publish pages from Lndr to Wordpress websites directly.
    55Author: Incc.io
    6 Version: 1.1
     6Version: 1.2
    77Author URI: http://www.lndr.co
    88*/
     
    2525
    2626global $lndr_version;
    27 $lndr_version = '1.1';
     27$lndr_version = '1.2';
    2828
    2929/**
     
    4545  if (get_site_option('lndr_version') != $lndr_version) {
    4646    // update for specific versions
    47     if ($lndr_version == '1.1') {
     47    if ($lndr_version == '1.2') {
    4848      // we had added a new service path for manual sync, however, there's no need to do anything
    4949      // as it is automatically added
  • lndr-page-builder/trunk/public/class-lndr-public.php

    r1768535 r2235501  
    11<?php
    22const LNDR_API_GET_PROJECT = 'https://www.lndr.co/v1/projects';
     3const LNDR_WP_HOMEPAGE_PATH = 'lndr-frontpage';
    34
    45
     
    421422          // update the new post meta
    422423          update_post_meta($existing_post_by_alias->ID, 'lndr_project_id', $page['id']);
     424          // set the page to the frontpage if necessary
     425          $this->set_front_page($existing_post_by_alias->ID, $path);
    423426        }
    424427      }
     
    439442              // @todo: catch error?
    440443              wp_update_post( $update_post );
     444              $this->set_front_page($existing_post_by_project_id->ID, $path);
    441445            }
    442446          }
     
    455459            ],
    456460          ];
    457           wp_insert_post($new_post);
     461          $post_id = wp_insert_post($new_post);
     462          if ((bool)$post_id) {
     463            $this->set_front_page($post_id, $path);
     464          }
    458465        }
    459466      }
     
    479486      return;
    480487    }
     488
     489    $frontpage_settings = get_option('show_on_front', 'posts');
    481490
    482491    foreach ($existing_posts as $post_id => $project_id) {
     
    486495        // @todo: future there can be an archived stage = trash or archive
    487496        wp_delete_post($post_id, true);
     497        // Check and reset frontpage settings as a fallback
     498        $this->reset_front_page($post_id, $frontpage_settings);
    488499      }
    489500      else
     
    494505         // @todo: future there can be an archived stage = trash or archive
    495506         wp_delete_post($post_id, true);
     507         $this->reset_front_page($post_id, $frontpage_settings);
    496508       }
    497509      }
     
    541553
    542554  /**
     555   * Set the special page deployed to wordpress as the front_page
     556   * @param $post_id | The ID of the page/post
     557   * @param $path | The path of the page/post which should be the name of the page
     558   */
     559   function set_front_page($post_id, $path) {
     560     if ($path == LNDR_WP_HOMEPAGE_PATH) {
     561       // Update this just in case
     562       update_option('show_on_front', 'page');
     563       // Setting the front-page ID to our page
     564       update_option('page_on_front', $post_id);
     565     }
     566   }
     567
     568   /**
     569    * Resetting the frontpage to showing a list of posts
     570    * @param $post_id | The post id of the page
     571    * @param $front_settings | get_option('show_on_front', 'posts');
     572    */
     573   function reset_front_page($post_id, $front_settings = 'posts') {
     574     if ($front_settings == 'page') {
     575       $frontpage_id = get_option('page_on_front', 0);
     576       if ($frontpage_id == $post_id) {
     577         update_option('show_on_front', 'posts');
     578         update_option('page_on_front', 0);
     579       }
     580     }
     581   }
     582
     583  /**
    543584   * Register our query parameter for WP to use
    544585   * @param $vars
  • lndr-page-builder/trunk/public/lndr_test.json

    r1767069 r2235501  
    22  "projects": [
    33    {
    4       "id": "81",
    5       "title": "Golf",
     4      "id": "72",
     5      "title": "Sporty",
    66      "description": "This is a smiple example project",
    77      "keywords": "simple, example, landing, hello, world",
    88      "template": "Sporty",
    9       "editor_url": "http://www.lndr.co/projects/81/edit",
    10       "screenshot": "http:///www.lndr.co/project_files/81/screenshot.jpg?refresh=cb05d691b1a0ccc7eb4f426d",
     9      "editor_url": "http://www.lndr.co/projects/72/edit",
     10      "screenshot": "http:///www.lndr.co/project_files/72/screenshot.jpg?refresh=cb05d691b1a0ccc7eb4f426d",
    1111      "url": "http:///p.lndr/sporty",
    12       "publish_url": "http://localhost:8888/sandbox_wp/golf",
    13       "published": "true",
     12      "publish_url": "http://localhost:8888/sandbox_d8/sports_demo",
     13      "published": "false",
    1414      "created_at": "Thu, 18 May 2017 07:22:12 UTC +00:00",
    1515      "updated_at": "Mon, 22 May 2017 09:01:22 UTC +00:00"
Note: See TracChangeset for help on using the changeset viewer.