Skip to content

Commit

Permalink
Merge pull request #244 from Piratenpartei/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
xwolfde authored Sep 13, 2022
2 parents 6344ebe + 21c8623 commit 64c823b
Show file tree
Hide file tree
Showing 19 changed files with 1,448 additions and 1,257 deletions.
5 changes: 5 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ function pirate_rogue_filter_media_comment_status( $open, $post_id ) {
/*-----------------------------------------------------------------------------------*/
require get_template_directory() . '/inc/jetpack.php';

/*-----------------------------------------------------------------------------------*/
/* Block Editor handling
/*-----------------------------------------------------------------------------------*/

require_once( get_template_directory() . '/inc/gutenberg.php');

/*-----------------------------------------------------------------------------------*/
/* This is the end of the code as we know it
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
const
{src, dest, watch, series, parallel} = require('gulp'),
sass = require('gulp-sass'),
sass = require('gulp-sass')(require('sass')),
postcss = require('gulp-postcss'),
autoprefixer = require('autoprefixer'),
babel = require('gulp-babel'),
Expand Down
383 changes: 194 additions & 189 deletions header.php

Large diffs are not rendered by default.

1,853 changes: 931 additions & 922 deletions inc/defaults.php

Large diffs are not rendered by default.

136 changes: 136 additions & 0 deletions inc/gutenberg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?php
/**
* @package WordPress
* @subpackage Pirate Rogue
* @since FAU 1.4.10
*/

/*
* Settings for Gutenberg Editor
* See also:
* https://wordpress.org/gutenberg/handbook/reference/theme-support/
* https://themecoder.de/2018/09/20/gutenberg-farbpalette/
* https://www.elmastudio.de/wordpress-themes-fuer-gutenberg-vorbereiten/
* https://www.billerickson.net/getting-your-theme-ready-for-gutenberg/
* https://wordpress.stackexchange.com/questions/320653/how-to-detect-the-usage-of-gutenberg
*/



/*-----------------------------------------------------------------------------------*/
/* We use our own color set in this theme and dont want autors to change text colors
/*-----------------------------------------------------------------------------------*/
function pirate_rogue_gutenberg_settings() {
global $is_gutenberg_enabled;

$is_gutenberg_enabled = pirate_rogue_blockeditor_is_active();

if ($is_gutenberg_enabled) {
return;
}

// Disable color palette.
add_theme_support( 'editor-color-palette' );

// Disable color picker.
add_theme_support( 'disable-custom-colors' );

// Dont allow font sizes of gutenberg
// https://wordpress.org/gutenberg/handbook/extensibility/theme-support/#block-font-sizes
add_theme_support('disable-custom-font-sizes');

// allow responsive embedded content
add_theme_support( 'responsive-embeds' );

// Remove Gutenbergs Userstyle and SVGs Duotone injections from 5.9.2
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );

}
add_action( 'after_setup_theme', 'pirate_rogue_gutenberg_settings' );

/*-----------------------------------------------------------------------------------*/
/* Activate scripts and style for backend use of Gutenberg
/*-----------------------------------------------------------------------------------*/
function pirate_rogue_add_gutenberg_assets() {
// Load the theme styles within Gutenberg.
global $is_gutenberg_enabled;

if ($is_gutenberg_enabled) {
wp_enqueue_style( 'pirate-rogue-gutenberg', get_theme_file_uri( '/css/pirate-rogue-theme-gutenberg.css' ), false );
}
}
// add_action( 'enqueue_block_editor_assets', 'pirate_rogue_add_gutenberg_assets' );

/*-----------------------------------------------------------------------------------*/
/* Remove Block Style from frontend as long wie dont use it
/*-----------------------------------------------------------------------------------*/
function pirate_rogue_deregister_blocklibrary_styles() {
global $is_gutenberg_enabled;

if (!$is_gutenberg_enabled) {
wp_dequeue_style( 'wp-block-library');
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wp-blocks-style' );
}
}
add_action( 'wp_enqueue_scripts', 'pirate_rogue_deregister_blocklibrary_styles', 100 );


/**
* Check if Block Editor is active.
* Must only be used after plugins_loaded action is fired.
*
* @return bool
*/
function pirate_rogue_blockeditor_is_active() {
// Gutenberg plugin is installed and activated.
$gutenberg = ! ( false === has_filter( 'replace_editor', 'gutenberg_init' ) );

// Block editor since 5.0.
$block_editor = version_compare( $GLOBALS['wp_version'], '5.0.0', '>' );

if ( ! $gutenberg && ! $block_editor ) {
return false;
}

if ( pirate_rogue_is_classic_editor_plugin_active() ) {
$editor_option = get_option( 'classic-editor-replace' );
$block_editor_active = array( 'no-replace', 'block' );
return in_array( $editor_option, $block_editor_active, true );
}
if (pirate_rogue_is_newsletter_plugin_active()) {
return true;
}
return false;
}

/**
* Check if Classic Editor plugin is active.
*
* @return bool
*/
function pirate_rogue_is_classic_editor_plugin_active() {

if ( ! function_exists( 'is_plugin_active' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}

if ( is_plugin_active( 'classic-editor/classic-editor.php' ) ) {
return true;
}

return false;
}

/*
* Check if our Block Editor based Newsletter Plugin is active
*/
function pirate_rogue_is_newsletter_plugin_active() {
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once ABSPATH . 'wp-admin/includes/plugin.php';
}


return false;
}
2 changes: 1 addition & 1 deletion inc/helper-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function pirate_rogue_form_onoff($name= '', $prevalue = 0, $labeltext = '', $ho
endif;

if ( ! function_exists( 'pirate_rogue_form_select' ) ) :
function pirate_rogue_form_select($name= '', $liste = array(), $prevalue, $labeltext = '', $howtotext = '', $showempty=1, $emptytext = '' ) {
function pirate_rogue_form_select($name= '', $liste = array(), $prevalue = '', $labeltext = '', $howtotext = '', $showempty=1, $emptytext = '' ) {
$name = pirate_rogue_san( $name );
$labeltext = pirate_rogue_san( $labeltext );
$emptytext = pirate_rogue_san( $emptytext );
Expand Down
16 changes: 2 additions & 14 deletions inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,7 @@ public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
}
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
public function display_element($el, &$children, $max_depth, $depth = 0, $args = array(), &$output){
$id = $this->db_fields['id'];
if(isset($children[$el->$id]))
$el->classes[] = 'has_children';

parent::display_element($el, $children, $max_depth, $depth, $args, $output);
}

}
/*-----------------------------------------------------------------------------------*/
/* Add a special walker for the main menu, allowing us, to add some stuff :)
Expand Down Expand Up @@ -492,13 +486,7 @@ public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
}
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
public function display_element($el, &$children, $max_depth, $depth = 0, $args = array(), &$output){
$id = $this->db_fields['id'];
if(isset($children[$el->$id]))
$el->classes[] = 'has_children';

parent::display_element($el, $children, $max_depth, $depth, $args, $output);
}

}
/*-----------------------------------------------------------------------------------*/
/* Get Image Meta Data
Expand Down
153 changes: 77 additions & 76 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,77 @@
{
"name": "Pirate-Rogue",
"textdomain": "pirate-rogue",
"version": "1.4.9",
"keywords": [
"WordPress",
"Theme",
"Piratenpartei"
],
"compatibility": {
"wprequires": "5.0",
"wptestedup": "5.7",
"phprequires": "7.3"
},
"author": {
"name": "xwolf",
"url": "https://xwolf.de"
},
"description": "Theme for pirate parties worldwide. This theme allows to chose between the mostly used color combinations (purple and orange) as main colors for designing elements. It uses several free to use pirate symbols and allows custom CSS. It was created for the german pirate party as replacement for their prior wordpress theme.",
"license": "GPL-3.0-or-later",
"licenseurl": "http://www.gnu.org/licenses/gpl-3.0.html",
"tags": "three-columns, two-columns, one-column, right-sidebar, featured-images",
"repository": {
"type": "git",
"url": "git+https://github.com/Piratenpartei/Pirate-Rogue.git",
"issues": "https://github.com/Piratenpartei/Pirate-Rogue/issues",
"clone": "git+https://github.com/Piratenpartei/Pirate-Rogue.git"
},
"browserslist": [
"last 3 years",
"ie 11"
],
"contributors": [],
"dependencies": {
"postcss": "^8.2.4"
},
"main": "index.php",
"maincss": "style.css",
"scripts": {
"start": "gulp",
"dev": "gulp dev",
"build": "gulp build",
"pot": "gulp pot"
},
"source": {
"js": "./js/",
"sass": "./src/sass/"
},
"jsdir": "./js/",
"cssdir": "./css/",
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/register": "^7.12.10",
"autoprefixer": "^10.2.3",
"cssnano": "^4.1.10",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-bump": "^3.2.0",
"gulp-concat": "^2.6.1",
"gulp-dart-sass": "^1.0.2",
"gulp-header": "^2.0.9",
"gulp-postcss": "^9.0.0",
"gulp-rename": "^2.0.0",
"gulp-sass": "^4.1.0",
"gulp-touch-cmd": "0.0.1",
"gulp-w3c-css": "^2.0.0",
"gulp-wp-pot": "^2.5.0",
"map-stream": "0.0.7",
"semver": "^7.3.4"
},
"bugs": {
"url": "https://github.com/Piratenpartei/Pirate-Rogue/issues"
},
"homepage": "https://github.com/Piratenpartei/Pirate-Rogue#readme"
}
{
"name": "Pirate-Rogue",
"textdomain": "pirate-rogue",
"version": "1.4.10",
"keywords": [
"WordPress",
"Theme",
"Piratenpartei"
],
"compatibility": {
"wprequires": "5.9",
"wptestedup": "6.0",
"phprequires": "7.4"
},
"author": {
"name": "xwolf",
"url": "https://xwolf.de"
},
"description": "Theme for pirate parties worldwide. This theme allows to chose between the mostly used color combinations (purple and orange) as main colors for designing elements. It uses several free to use pirate symbols and allows custom CSS. It was created for the german pirate party as replacement for their prior wordpress theme.",
"license": "GPL-3.0-or-later",
"licenseurl": "http://www.gnu.org/licenses/gpl-3.0.html",
"tags": "three-columns, two-columns, one-column, right-sidebar, featured-images",
"repository": {
"type": "git",
"url": "git+https://github.com/Piratenpartei/Pirate-Rogue.git",
"issues": "https://github.com/Piratenpartei/Pirate-Rogue/issues",
"clone": "git+https://github.com/Piratenpartei/Pirate-Rogue.git"
},
"browserslist": [
"last 3 years",
"ie 11"
],
"contributors": [],
"dependencies": {
"npm-check-updates": "^16.1.2",
"postcss": "^8.2.4"
},
"main": "index.php",
"maincss": "style.css",
"scripts": {
"start": "gulp",
"dev": "gulp dev",
"build": "gulp build",
"pot": "gulp pot"
},
"source": {
"js": "./js/",
"sass": "./src/sass/"
},
"jsdir": "./js/",
"cssdir": "./css/",
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"@babel/register": "^7.12.10",
"autoprefixer": "^10.2.3",
"cssnano": "^4.1.10",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-bump": "^3.2.0",
"gulp-concat": "^2.6.1",
"gulp-dart-sass": "^1.0.2",
"gulp-header": "^2.0.9",
"gulp-postcss": "^9.0.0",
"gulp-rename": "^2.0.0",
"gulp-sass": "^5.1.0",
"gulp-touch-cmd": "0.0.1",
"gulp-w3c-css": "^2.0.0",
"gulp-wp-pot": "^2.5.0",
"map-stream": "0.0.7",
"semver": "^7.3.4"
},
"bugs": {
"url": "https://github.com/Piratenpartei/Pirate-Rogue/issues"
},
"homepage": "https://github.com/Piratenpartei/Pirate-Rogue#readme"
}
3 changes: 2 additions & 1 deletion src/sass/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $stylecomment_themeversion: $version;
//////////////////////////////////////////////////////////////////////////////
$color-main: #ff8800;
$color-second: #672082;
$color-third: #698bc1; //
$color-third: #698bc1;
$color-four: #148f93;

// Colorsets
Expand Down Expand Up @@ -98,6 +98,7 @@ $font-family-quotation: $font-family-serif;

// Font Sizes
$font-size-base: 16;
$font-size-gridbase: 16;
$font-size-headersmall: 15;
$font-size-sitetitle: 25;
$font-size-entrytitle: 20;
Expand Down
5 changes: 5 additions & 0 deletions src/sass/elements/_general-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ p.text-big, .widget_mc4wp_form_widget p,
}

.entry-content p {
hypens: normal;




&.pull-left,
&.pull-right {
@include px2rem($font-size-bigtext);
Expand Down
3 changes: 3 additions & 0 deletions src/sass/elements/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ a {
.entry-content &,
.comment-text & {
font-weight: bold;
word-break: break-word;
hyphens: none;

}
.author-bio &,
.textwidget & {
Expand Down
2 changes: 0 additions & 2 deletions src/sass/elements/_quotes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ blockquote {
font-family: $font-family-quotation;
border-left-style: solid;
border-left-width: 15px;
// border-right-style: solid;
// border-right-width: 2px;
font-style: italic;
@include hyphens(manual);

Expand Down
Loading

0 comments on commit 64c823b

Please sign in to comment.