feat: Initial WordPress project
This commit is contained in:
15
wp-content/themes/headless/includes/vendors/acf.php
vendored
Normal file
15
wp-content/themes/headless/includes/vendors/acf.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// Disable ACF / ACFE modules
|
||||
add_filter( 'acf/settings/enable_post_types', '__return_false' );
|
||||
add_action( 'acf/init', 'headless_acf_init' );
|
||||
function headless_acf_init() {
|
||||
acf_update_setting( 'acfe/modules/block_types', false );
|
||||
acf_update_setting( 'acfe/modules/categories', false );
|
||||
acf_update_setting( 'acfe/modules/forms', false );
|
||||
acf_update_setting( 'acfe/modules/options', false );
|
||||
acf_update_setting( 'acfe/modules/options_pages', false );
|
||||
acf_update_setting( 'acfe/modules/post_types', false );
|
||||
acf_update_setting( 'acfe/modules/taxonomies', false );
|
||||
acf_update_setting( 'acfe/modules/templates', false );
|
||||
}
|
||||
1
wp-content/themes/headless/includes/vendors/rankmath.php
vendored
Normal file
1
wp-content/themes/headless/includes/vendors/rankmath.php
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<?php
|
||||
139
wp-content/themes/headless/includes/vendors/tinymce.php
vendored
Normal file
139
wp-content/themes/headless/includes/vendors/tinymce.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
// Enable formats (styleselect) in TinyMCE
|
||||
add_filter( 'mce_buttons', 'headless_tinymce_styleselect' );
|
||||
function headless_tinymce_styleselect( $buttons ) {
|
||||
array_unshift( $buttons, 'styleselect' );
|
||||
return $buttons;
|
||||
}
|
||||
|
||||
// Configure TinyMCE
|
||||
add_filter( 'tiny_mce_before_init', 'headless_tiny_mce_before_init' );
|
||||
function headless_tiny_mce_before_init( $settings ) {
|
||||
// Reset TinyMCE editor CSS
|
||||
if ( isset( $settings['content_css'] ) ) {
|
||||
$content_css = explode( ',', $settings['content_css'] );
|
||||
unset( $content_css[1] ); // wp-content.min.css
|
||||
$settings['content_css'] = implode( ',', $content_css );
|
||||
}
|
||||
|
||||
// Format styles
|
||||
$settings['style_formats'] = wp_json_encode(
|
||||
array(
|
||||
array(
|
||||
'title' => "Caractères",
|
||||
'items' => array(// Inline styles
|
||||
array(
|
||||
'title' => __( "Semi-bold", 'headless' ),
|
||||
'inline' => 'span',
|
||||
'classes' => 'font-semibold',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => "Liens",
|
||||
'items' => array(// Link styles
|
||||
array(
|
||||
'title' => "Lien (opacité)",
|
||||
'selector' => 'a',
|
||||
'classes' => 'link-opacity',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => "Listes",
|
||||
'items' => array(// List styles
|
||||
array(
|
||||
'title' => "Liste horizontale",
|
||||
'selector' => 'ul,ol',
|
||||
'classes' => 'list-horizontal',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => "Paragraphes",
|
||||
'items' => array(// Paragraph styles
|
||||
array(
|
||||
'title' => "Paragraphe vedette",
|
||||
'block' => 'p',
|
||||
'classes' => 'paragraph-lead',
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'title' => "Titres",
|
||||
'items' => array(// Heading styles
|
||||
array(
|
||||
'title' => "Titre 1",
|
||||
'selector' => 'h1,h2,h3,h4',
|
||||
'classes' => 'heading-1',
|
||||
),
|
||||
array(
|
||||
'title' => "Titre 2",
|
||||
'selector' => 'h1,h2,h3,h4',
|
||||
'classes' => 'heading-2',
|
||||
),
|
||||
array(
|
||||
'title' => "Titre 3",
|
||||
'selector' => 'h1,h2,h3,h4',
|
||||
'classes' => 'heading-3',
|
||||
),
|
||||
array(
|
||||
'title' => "Titre 4",
|
||||
'selector' => 'h1,h2,h3,h4',
|
||||
'classes' => 'heading-4',
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Block styles
|
||||
$settings['block_formats'] = implode(
|
||||
';',
|
||||
array(
|
||||
'Paragraph=p',
|
||||
'Heading 1=h1',
|
||||
'Heading 2=h2',
|
||||
'Heading 3=h3',
|
||||
'Heading 4=h4',
|
||||
)
|
||||
);
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
// Override TinyMCE editor styles
|
||||
add_filter( 'mce_css', 'headless_override_editor_styles' );
|
||||
function headless_override_editor_styles() {
|
||||
return get_stylesheet_directory_uri() . '/editor-style.css';
|
||||
}
|
||||
|
||||
// Remove default TinyMCE styles for all editors (WordPress & ACF)
|
||||
add_action( 'admin_print_footer_scripts', 'headless_remove_tinymce_default_styles', 99 );
|
||||
function headless_remove_tinymce_default_styles() {
|
||||
?>
|
||||
<script>
|
||||
(function($) {
|
||||
if (typeof tinymce !== 'undefined') {
|
||||
tinymce.on('AddEditor', function({editor}) {
|
||||
editor.on('init', function() {
|
||||
$(editor.iframeElement).contents().find("link[href*='content.min.css']").remove();
|
||||
});
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
// Convert absolute URLs to relative in link query
|
||||
add_filter( 'wp_link_query', 'headless_tinymce_relative_urls' );
|
||||
function headless_tinymce_relative_urls( $results ) {
|
||||
foreach ( $results as &$result ) {
|
||||
if ( empty( $result['permalink'] ) ) {
|
||||
continue;
|
||||
}
|
||||
$result['permalink'] = str_replace( get_home_url(), '', $result['permalink'] );
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
17
wp-content/themes/headless/includes/vendors/wpgraphql.php
vendored
Normal file
17
wp-content/themes/headless/includes/vendors/wpgraphql.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
// Default WPGraphQL settings
|
||||
add_filter( 'graphql_get_setting_section_field_value', 'headless_wpgraphql_settings', 10, 5 );
|
||||
function headless_wpgraphql_settings( $value, $default_value, $option_name, $section_fields, $section_name ) {
|
||||
if ( $section_name === 'graphql_general_settings' ) {
|
||||
switch ( $option_name ) {
|
||||
case 'graphql_endpoint':
|
||||
$value = 'graphql';
|
||||
break;
|
||||
case "public_introspection_enabled":
|
||||
$value = "on";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
Reference in New Issue
Block a user