Un utente ha chiesto 👇
Ciao,
Voglio sbarazzarmi di “powered by GeneratePress” nella sezione piè di pagina.
Ho provato molti dei seguenti.
1. ha cambiato la visualizzazione in CSS ma non ha finito nulla.
2. Ho inserito il codice in funcion.php nel mio child theme. Ma niente è stato risolto.
Quello che segue è il codice che ho inserito
add_action('after_setup_theme','generate_copyright_remove_default_message');
function generate_copyright_remove_default_message()
{
remove_action( 'generate_credits', 'generate_add_footer_info' );
remove_action( 'generate_copyright_line','generate_add_login_attribution' );
}
/**
* Add the custom copyright
* @since 0.1
*/
add_action('generate_credits','generate_copyright_add_custom_message');
function generate_copyright_add_custom_message()
{
?>
<p>©2018 Oriental Mobile Massage</p>
<?php
}
Ho cercato nella pagina e ho cercato di trovare la sezione di generazione “body> div.site-footer”.
Ma non sono riuscito a capirlo.
Ho già controllato
1.https://docs.generatepress.com/article/changing-the-copyright-message/
2.https://generatepress.com/forums/topic/disable-copyright-footer/
3.https://gist.github.com/generatepress/36c0c52479679252af28
Qualcuno potrebbe dirmi come risolverlo?
(@leohsiang)
2 anni, 6 mesi fa
Ciao,
Hai provato a utilizzare questa funzione qui?
https://docs.generatepress.com/article/changing-the-copyright-message/#using-a-function
Fammi sapere 🙂
Lanciatore di thread
(@ omm2018)
2 anni, 6 mesi fa
Ciao Leo,
Sì, l’ho provato più e più volte ma non ha funzionato neanche.
(@leohsiang)
2 anni, 6 mesi fa
Come stai applicando il codice?
Ho appena testato il codice esatto in frammenti di codice e ha funzionato per me:
https://docs.generatepress.com/article/adding-php/#code-snippets
https://www.screencast.com/t/oAwihhCy4B8
Questa risposta è stata modificata 2 anni, 6 mesi fa. Autore del tema
(@ edge22)
2 anni, 6 mesi fa
Tutto quello che devi fare è confermare, ecco il codice importante:
add_filter( 'generate_copyright','tu_custom_copyright' );
function tu_custom_copyright() {
?>
Your new message in here. You can add anything you want, including PHP and HTML.
<?php
}
Lanciatore di thread
(@ omm2018)
2 anni, 6 mesi fa
Grazie, Leo e Tom.
Ho aggiunto il plugin “snippet code” e ho inserito quel codice. Ha funzionato.
Ma perché non ha funzionato aggiungendo function.php al mio tema figlio GeneratePress?
Forse avrei dovuto aggiungerlo sul tema della genitorialità?
Grazie.
Autore del tema
(@ edge22)
2 anni, 6 mesi fa
Dovrebbe funzionare nel file functions.php del child theme. Assicurati che abbia un nome functions.php
.
Lanciatore di thread
(@ omm2018)
2 anni, 6 mesi fa
Ciao Tom, ho provato ad aggiungere functions.php
Hai un errore fatale.
Il messaggio è:
“Errore irreversibile: impossibile riscrivere gene_no_cache_dynamic_css () (precedentemente dichiarato in /home/aunnatur/public_html/wp-content/themes/generatepress/inc/css-output.php:715) in / home / aunnatur / public_html / wp-content / temi / genepress / inc / css-output.php online 715 “
Non ne ho modificato alcuna parte in css-output.php.
Ora cosa dovrei fare?
Posso accedere al mio sito Web solo da una finestra di navigazione in incognito.
Non posso andare a un pannello adesso.
Questa risposta è stata modificata 2 anni, 6 mesi fa. Questa risposta è stata modificata 2 anni, 6 mesi fa. Autore del tema
(@ edge22)
2 anni, 6 mesi fa
Il tuo file functions.php dovrebbe essere vuoto per impostazione predefinita.
Controlla il file functions.php in questo tema figlio vuoto: http://generatepress.com/api/themes/generatepress_child.zip
Fammi sapere 🙂
Lanciatore di thread
(@ omm2018)
2 anni, 6 mesi fa
Dopo il ripristino, ho provato ad aggiungere di nuovo lo script, ma non sono riuscito a farlo.
Ha restituito l’errore di sintassi.
“Le modifiche al codice PHP sono state annullate a causa di un errore online 6 del file wp-content / theme / genepress-child / functions.php. Correggi e prova a salvare di nuovo.
errore di sintassi, inaspettato ‘}’ “
Il codice è:
add_filter( 'generate_copyright','tu_custom_copyright' );
function tu_custom_copyright() {
?>
©2018 Oriental Mobile Massage
<?php
}
Autore del tema
(@ edge22)
2 anni, 6 mesi fa
Puoi condividere come appare il file functions.php completo?
Lanciatore di thread
(@ omm2018)
2 anni, 6 mesi fa
Sì. Ma ora non c’è codice nel child theme. Ho semplicemente provato ad aggiungere il codice sopra.
Functions.php è il genitore
<?php
/**
* GeneratePress.
*
* Please do not make any edits to this file. All edits should be done in a child theme.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// Set our theme version.
define( 'GENERATE_VERSION', '2.1.4' );
if ( ! function_exists( 'generate_setup' ) ) {
add_action( 'after_setup_theme', 'generate_setup' );
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since 0.1
*/
function generate_setup() {
// Make theme available for translation.
load_theme_textdomain( 'generatepress' );
// Add theme support for various features.
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'status' ) );
add_theme_support( 'woocommerce' );
add_theme_support( 'title-tag' );
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) );
add_theme_support( 'customize-selective-refresh-widgets' );
add_theme_support( 'custom-logo', array(
'height' => 70,
'width' => 350,
'flex-height' => true,
'flex-width' => true,
) );
// Register primary menu.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'generatepress' ),
) );
/**
* Set the content width to something large
* We set a more accurate width in generate_smart_content_width()
*/
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width = 1200; /* pixels */
}
// This theme styles the visual editor to resemble the theme style.
add_editor_style( 'css/admin/editor-style.css' );
}
}
/**
* Get all necessary theme files
*/
require get_template_directory() . '/inc/theme-functions.php';
require get_template_directory() . '/inc/defaults.php';
require get_template_directory() . '/inc/class-css.php';
require get_template_directory() . '/inc/css-output.php';
require get_template_directory() . '/inc/general.php';
require get_template_directory() . '/inc/customizer.php';
require get_template_directory() . '/inc/markup.php';
require get_template_directory() . '/inc/element-classes.php';
require get_template_directory() . '/inc/typography.php';
require get_template_directory() . '/inc/plugin-compat.php';
require get_template_directory() . '/inc/migrate.php';
require get_template_directory() . '/inc/deprecated.php';
if ( is_admin() ) {
require get_template_directory() . '/inc/meta-box.php';
require get_template_directory() . '/inc/dashboard.php';
}
/**
* Load our theme structure
*/
require get_template_directory() . '/inc/structure/archives.php';
require get_template_directory() . '/inc/structure/comments.php';
require get_template_directory() . '/inc/structure/featured-images.php';
require get_template_directory() . '/inc/structure/footer.php';
require get_template_directory() . '/inc/structure/header.php';
require get_template_directory() . '/inc/structure/navigation.php';
require get_template_directory() . '/inc/structure/post-meta.php';
require get_template_directory() . '/inc/structure/sidebars.php';
Autore del tema
(@ edge22)
2 anni, 6 mesi fa
Questi dovrebbero essere il tema functions.php di tuo figlio:
<?php
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/
function generatepress_child_enqueue_scripts() {
if ( is_rtl() ) {
wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
}
}
add_action( 'wp_enqueue_scripts', 'generatepress_child_enqueue_scripts', 100 );
add_filter( 'generate_copyright','tu_custom_copyright' );
function tu_custom_copyright() {
?>
Your new message in here. You can add anything you want, including PHP and HTML.
<?php
}
Lanciatore di thread
(@ omm2018)
2 anni, 6 mesi fa
Va bene. Grazie, Tom.
Va tutto bene adesso.
Lo apprezzo.
Grazie ancora per il tuo tempo.
Autore del tema
(@ edge22)
2 anni, 6 mesi fa
Sono contento di aver potuto aiutare 🙂
Was this helpful?
0 / 0