Giter VIP home page Giter VIP logo

page-template-example's People

Contributors

davidcramer avatar joel-james avatar maor avatar mbing avatar mediamichael avatar r-ghilardi avatar sebastianschmid avatar tommcfarlin avatar trsenna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

page-template-example's Issues

Can't I include my plugins template?

I was wondering, isn't there any way I could include my plugin specific template (archive, single etc) via plugins directory, instead of copying them to theme main folder first????

CPT support

How to make it work with Custom Post Types?

Quick Edit

Hi, @tommcfarlin. Great solution!
But some problem in Quick Edit - new custom page template not exists.

screenshot_1

Integration with ACF

Hello,
I'm using your code to implement a template via plugins.
To change the template from the admin side using ACF advanced custom fields. www.advancedcustomfields.com

So everything is right, but I found a problem:

When I open the Site template list using the plugin ACF, the law there are no templates loaded with your code.

I do not understand why. They should not be recorded in the wordpress system?
Can you find a solution?

Thanks for your code and your support
bye

No working with WordPress v4.7

Hello Tom,

Unfortunatelly this approach will no longer work with the upcoming WordPress v4.7

Any ideas on how we can make it work so that we can continue using the code?

Many thanks,
Zulf

Help: Inactivates Template Pages of Theme itself

Hi there,

your class works fine, but I´ve a slight problem. It integrates my template Page of my Plugin I created, but it seems taht the page templates within the theme itself are overwritten, or no longer visible.

Can you give me a hint?

P.S.: I´m using your plugin boilerplate and I want to integrate this class in the plugin class.

Update template on theme switch and on plugin update

My intention was to make a pull request, but I'm having issues with my fork triggering headers already sent on activation.

I gave up, deleted the fork, and will leave the tips here. Curiously, I used your technique in a plugin of mine without any glitches...

Here's how I used it:

Theme switch

public function switching_theme( $new_name, $new_theme )
{
    $old_theme = get_option( 'theme_switched' );

    $template_path_app = get_theme_root( $old_theme ) . "/$old_theme/template-example.php";    
    if( file_exists( $template_path_app ) )
        unlink( $template_path_app );

    $this->register_project_template();
}
add_action( 'switch_theme', array( $this, 'switching_theme' ), 10, 2 );

Plugin update
In case our plugin is updatable via some repo.

// In the constructor
$this->plugin_slug   = plugin_basename( __FILE__ );

public function refresh_template(  $true, $hook_extra, $result ) {

    if( isset( $hook_extra['plugin'] ) &&  $hook_extra['plugin'] == $this->plugin_slug  ) {

        $this->register_project_template();
        $this->deregister_project_template();

    }

    return $true; 
} 
add_filter( 'upgrader_post_install', array( $this, 'refresh_template' ), 10, 3 );

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.