master 4e1353ca894b cached
5 files
7.1 KB
1.9k tokens
8 symbols
1 requests
Download .txt
Repository: woocommerce/theme-customisations
Branch: master
Commit: 4e1353ca894b
Files: 5
Total size: 7.1 KB

Directory structure:
gitextract_61fx_sma/

├── custom/
│   ├── custom.js
│   ├── functions.php
│   └── style.css
├── readme.txt
└── theme-customisations.php

================================================
FILE CONTENTS
================================================

================================================
FILE: custom/custom.js
================================================
jQuery(document).ready(function($){
	// Custom jQuery goes here
});


================================================
FILE: custom/functions.php
================================================
<?php
/**
 * Functions.php
 *
 * @package  Theme_Customisations
 * @author   WooThemes
 * @since    1.0.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * functions.php
 * Add PHP snippets here
 */


================================================
FILE: custom/style.css
================================================
/**
 * Add any custom CSS here.
 *
 * This file will be loaded after all other theme stylesheets.
 */

================================================
FILE: readme.txt
================================================
=== Theme Customisations ===
Contributors: jameskoster, woothemes
Tags: theme, edit, edits, customise, customisation, customize, customization, css, php, jquery
Requires at least: 3.0.0
Tested up to: 4.5.2
Stable tag: 1.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

A handy little plugin to contain your theme/plugin customisation snippets.

== Description ==

Think of this plugin as an alternative to adding code snippets to the functions.php, or style.css file in your child theme. Why? It keeps all of your changes in one location, independent of the other components that make up your web site. That means you can safely perform theme / plugin updates without the worry of losing your modifications as well as easily deactivating your customisations to check for conflicts.

*Note:* This plugin doesn't actually do anything on its own. It is purely a convenient place for you to store your own theme/plugin customisations.

== Installation ==

1. Upload `theme-customisations` to the `/wp-content/plugins/` directory
2. Add your customisations to the plugin either locally or via Plugins > Editor in the Dashboard
3. Activate the plugin through the 'Plugins' menu in WordPress
4. Done!

== Usage ==

* Add any CSS snippets to `custom/style.css`. This file is found in this plugin.
* Add any PHP snippets to `custom/functions.php`. This file is found in this plugin.
* Add any jQuery snippets to `custom/custom.js`. This file is found in this plugin.
* Add custom top level template files (page.php, single.php etc) to `custom/templates/`. You will need to create the templates folder.
* Add any WooCommerce template files to `custom/templates/woocommerce`. You will need to create the templates and woocommerce folders.
* Activate the plugin.

== Frequently Asked Questions ==

= Isn't this what child themes are for? =

Well, kind of. Sure, you can put your modifications in a child theme, but there are many places (including woothemes.com and wordpress.org) to download and use child themes. If you decide to use a child theme built by a third party and make modifications there, you would lose them when performing updates. Also if you make all your modifications in your own custom child theme then realise that you want to use a child theme from your favorite theme vendor, you'll have to move all of your modifications somewhere else. To avoid that hassle, use this plugin.

= What templates can I override via this plugin? =

As you know, to override a parent themes template file via child theme you can just copy/paste it into your child theme. This is the one drawback of using this plugin - you can only override top level templates - not template partials. This means that you could add a `page.php` template file to the `/custom/templates/` dir of this plugin and it would work fine. You could not however add a `header.php` or `footer.php` template file. Those would not work.

= Should I put all my customisations in this single plugin? =

That's entirely up to you. There's nothing to stop you from duplicating this plugin and changing the name. That way you could theoretically keep each of your customisations in their own individual plugins. This can be very handy when debugging, or if you want to quickly enable/disable a specific customisations temporarily.


================================================
FILE: theme-customisations.php
================================================
<?php
/**
 * Plugin Name:       Theme Customisations
 * Description:       A handy little plugin to contain your theme customisation snippets.
 * Plugin URI:        http://github.com/woothemes/theme-customisations
 * Version:           1.0.0
 * Author:            WooThemes
 * Author URI:        https://www.woocommerce.com/
 * Requires at least: 3.0.0
 * Tested up to:      4.4.2
 *
 * @package Theme_Customisations
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Main Theme_Customisations Class
 *
 * @class Theme_Customisations
 * @version	1.0.0
 * @since 1.0.0
 * @package	Theme_Customisations
 */
final class Theme_Customisations {

	/**
	 * Set up the plugin
	 */
	public function __construct() {
		add_action( 'init', array( $this, 'theme_customisations_setup' ), -1 );
		require_once( 'custom/functions.php' );
	}

	/**
	 * Setup all the things
	 */
	public function theme_customisations_setup() {
		add_action( 'wp_enqueue_scripts', array( $this, 'theme_customisations_css' ), 999 );
		add_action( 'wp_enqueue_scripts', array( $this, 'theme_customisations_js' ) );
		add_filter( 'template_include',   array( $this, 'theme_customisations_template' ), 11 );
		add_filter( 'wc_get_template',    array( $this, 'theme_customisations_wc_get_template' ), 11, 5 );
	}

	/**
	 * Enqueue the CSS
	 *
	 * @return void
	 */
	public function theme_customisations_css() {
		wp_enqueue_style( 'custom-css', plugins_url( '/custom/style.css', __FILE__ ) );
	}

	/**
	 * Enqueue the Javascript
	 *
	 * @return void
	 */
	public function theme_customisations_js() {
		wp_enqueue_script( 'custom-js', plugins_url( '/custom/custom.js', __FILE__ ), array( 'jquery' ) );
	}

	/**
	 * Look in this plugin for template files first.
	 * This works for the top level templates (IE single.php, page.php etc). However, it doesn't work for
	 * template parts yet (content.php, header.php etc).
	 *
	 * Relevant trac ticket; https://core.trac.wordpress.org/ticket/13239
	 *
	 * @param  string $template template string.
	 * @return string $template new template string.
	 */
	public function theme_customisations_template( $template ) {
		if ( file_exists( untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/custom/templates/' . basename( $template ) ) ) {
			$template = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/custom/templates/' . basename( $template );
		}

		return $template;
	}

	/**
	 * Look in this plugin for WooCommerce template overrides.
	 *
	 * For example, if you want to override woocommerce/templates/cart/cart.php, you
	 * can place the modified template in <plugindir>/custom/templates/woocommerce/cart/cart.php
	 *
	 * @param string $located is the currently located template, if any was found so far.
	 * @param string $template_name is the name of the template (ex: cart/cart.php).
	 * @return string $located is the newly located template if one was found, otherwise
	 *                         it is the previously found template.
	 */
	public function theme_customisations_wc_get_template( $located, $template_name, $args, $template_path, $default_path ) {
		$plugin_template_path = untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/custom/templates/woocommerce/' . $template_name;

		if ( file_exists( $plugin_template_path ) ) {
			$located = $plugin_template_path;
		}

		return $located;
	}
} // End Class

/**
 * The 'main' function
 *
 * @return void
 */
function theme_customisations_main() {
	new Theme_Customisations();
}

/**
 * Initialise the plugin
 */
add_action( 'plugins_loaded', 'theme_customisations_main' );
Download .txt
gitextract_61fx_sma/

├── custom/
│   ├── custom.js
│   ├── functions.php
│   └── style.css
├── readme.txt
└── theme-customisations.php
Download .txt
SYMBOL INDEX (8 symbols across 1 files)

FILE: theme-customisations.php
  class Theme_Customisations (line 27) | final class Theme_Customisations {
    method __construct (line 32) | public function __construct() {
    method theme_customisations_setup (line 40) | public function theme_customisations_setup() {
    method theme_customisations_css (line 52) | public function theme_customisations_css() {
    method theme_customisations_js (line 61) | public function theme_customisations_js() {
    method theme_customisations_template (line 75) | public function theme_customisations_template( $template ) {
    method theme_customisations_wc_get_template (line 94) | public function theme_customisations_wc_get_template( $located, $templ...
  function theme_customisations_main (line 110) | function theme_customisations_main() {
Condensed preview — 5 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (8K chars).
[
  {
    "path": "custom/custom.js",
    "chars": 68,
    "preview": "jQuery(document).ready(function($){\n\t// Custom jQuery goes here\n});\n"
  },
  {
    "path": "custom/functions.php",
    "chars": 233,
    "preview": "<?php\n/**\n * Functions.php\n *\n * @package  Theme_Customisations\n * @author   WooThemes\n * @since    1.0.0\n */\n\nif ( ! de"
  },
  {
    "path": "custom/style.css",
    "chars": 105,
    "preview": "/**\r\n * Add any custom CSS here.\r\n *\r\n * This file will be loaded after all other theme stylesheets.\r\n */"
  },
  {
    "path": "readme.txt",
    "chars": 3323,
    "preview": "=== Theme Customisations ===\nContributors: jameskoster, woothemes\nTags: theme, edit, edits, customise, customisation, cu"
  },
  {
    "path": "theme-customisations.php",
    "chars": 3582,
    "preview": "<?php\n/**\n * Plugin Name:       Theme Customisations\n * Description:       A handy little plugin to contain your theme c"
  }
]

About this extraction

This page contains the full source code of the woocommerce/theme-customisations GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5 files (7.1 KB), approximately 1.9k tokens, and a symbol index with 8 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!