Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Puchar WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Jak dodać dynamiczną datę praw autorskich w stopce WordPressa?

Uwaga redakcyjna: Otrzymujemy prowizję z linków partnerskich na WPBeginner. Prowizje nie mają wpływu na opinie i oceny naszych redaktorów. Dowiedz się więcej o Proces redakcyjny.

Czy chcesz dodać dynamiczną datę praw autorskich w twojej stopce WordPress?

Witryna internetowa z nieaktualną datą praw autorskich może wyglądać nieprofesjonalnie. Dodanie dynamicznej daty praw autorskich do stopki twojej witryny pokazuje odwiedzającym, że twoja witryna internetowa jest aktualna i regularnie utrzymywana.

W tym artykule pokażemy, jak łatwo dodać dynamiczną datę praw autorskich w stopce twojej witryny internetowej WordPress.

Adding dynamic copyright date in WordPress footer

Data praw autorskich zazwyczaj obejmuje obecny, aktualny rok lub zakres lat, w których treść, projekt i kod twojej witryny internetowej WordPress są zabezpieczone prawami autorskimi.

Data praw autorskich na twojej witrynie internetowej powinna być obecna, aktualna, ale ręczna aktualizacja wymaga czasu i możesz o tym zapomnieć.

Właśnie w tym może pomóc dynamiczna data praw autorskich. Będzie ona automatycznie aktualizowana, aby zapewnić, że data jest dokładna i zgodna z prawami autorskimi obowiązującymi w różnych krajach.

Pomaga również zabezpieczyć twoją treść przed naruszeniem praw autorskich i plagiatem.

Ponadto zaktualizowana data praw autorskich sygnalizuje wyszukiwarkom, że twoja witryna jest dobrze utrzymana i włączana. Może to pomóc poprawić rankingi wyszukiwarek i przyciągnąć więcej ruchu do twojej witryny internetowej.

W tym artykule pokażemy, jak łatwo dodać dynamiczną datę praw autorskich w stopce WordPress. Możesz skorzystać z poniższych szybkich odnośników, aby przejść do wybranej metody:

Jeśli chcesz wygenerować dynamiczną datę praw autorskich, która obejmuje wszystkie lata od początku Twojego bloga WordPress do obecnego, aktualnego roku, to ta metoda jest dla Ciebie. Działa ona w oparciu o datę publikacji twojego najstarszego wpisu i najnowszego wpisu.

Aby dodać dynamiczną datę praw autorskich do stopki WordPress, wielu poradników powie ci, aby dodać własny kod do pliku functions.php twojego motywu. Jednak najmniejszy błąd podczas wpisywania kodu może zepsuć twoją witrynę internetową.

Dlatego zalecamy korzystanie z WPCode, który jest najlepszą wtyczką do fragmentów kodu WordPress na rynku. Jest to najłatwiejszy i najbezpieczniejszy sposób dodawania kodu do twojej witryny internetowej.

Najpierw należy zainstalować i włączyć wtyczkę WPCode. Aby uzyskać więcej instrukcji, możesz zapoznać się z naszym przewodnikiem dla początkujących, jak zainstalować wtyczkę WordPress.

Uwaga: W tym poradniku można również skorzystać z darmowej wtyczki WPCode. Uaktualnienie do wersji Pro daje jednak dostęp do biblioteki fragmentów kodu w chmurze, inteligentnej logiki warunkowej i nie tylko.

Po włączaniu wystarczy przejść na stronę Code Snippets ” + Add Snippet z panelu bocznego administratora WordPress.

Stąd przejdź do opcji „Add Your Custom Code (New Snippet)” i kliknij znajdujący się pod nią przycisk „Use Snippet”.

Add new snippet

Spowoduje to przekierowanie do strony „Create Custom Snippet”, gdzie możesz zacząć od wpisania rodzaju nazwy dla twojego fragmentu kodu. Należy pamiętać, że nazwa ta nie będzie wyświetlana na front-endzie i służy jedynie do celów identyfikacyjnych.

Następnie należy wybrać „Fragment kodu PHP” jako rodzaj kodu z rozwijanego menu w prawym rogu.

Choose PHP as code type for the dynamic copyright date code

Gdy już to zrobisz, skopiuj i wklej poniższy kod w polu „Podgląd kodu”:

if ( ! function_exists( 'wpb_copyright' ) ) {
	function wpb_copyright() {
		// Cache the output so we don't have to run the query on every page load.
		$output = get_transient( 'wpb_copyright_text' );
		if ( false !== $output ) {
			// Return the cached output.
			return $output;
		}
		global $wpdb;
		$copyright_dates = $wpdb->get_results(
			"SELECT YEAR(min(post_date_gmt)) AS firstdate, YEAR(max(post_date_gmt)) AS lastdate FROM $wpdb->posts WHERE post_status = 'publish'"
		);
		$output          = '';
		if ( $copyright_dates ) {
			$output = '© ' . $copyright_dates[0]->firstdate;
			if ( $copyright_dates[0]->firstdate !== $copyright_dates[0]->lastdate ) {
				$output .= '-' . $copyright_dates[0]->lastdate;
			}
			// Set the value as a transient so we only run the query 1x per day.
			set_transient( 'wpb_copyright_text', $output, DAY_IN_SECONDS );
		}

		return $output;
	}
}

echo wpb_copyright();

Po włączaniu, kod ten automatycznie pobierze dane i wyświetli datę praw autorskich zgodnie z najstarszymi i najnowszymi wpisami na twojej witrynie internetowej.

Następnie przewiń w dół do sekcji „Wstaw” i wybierz metodę „Krótki kod”. Używamy tej metody, ponieważ chcemy specjalnie dodać kod do stopki WordPress.

Use the shortcode method

Na koniec przewiń z powrotem do góry i przełącz przełącznik „Nieaktywne” na „Aktywne”.

Gdy to zrobisz, kliknij przycisk „Zapisz fragment kodu”, aby zapisać twoje ustawienia.

Save the code snippet for adding dynamic copyright date

Teraz należy przewinąć z powrotem do sekcji „Wstaw” i skopiować krótki kod, klikając przycisk „Kopiuj” obok niego.

Pamiętaj, że nie będziesz mógł skopiować krótkiego kodu, dopóki nie włączysz i nie zapiszesz fragmentu kodu.

Copy the shortcode for the dynamic copyright date

Dodaj dynamiczną datę praw autorskich do stopki WordPress za pomocą widżetu

Teraz musisz dodać krótki kod do twojej stopki WordPress. Ta metoda jest dla Ciebie, jeśli używasz klasycznego motywu bez pełnego edytora witryny.

Po skopiowaniu krótkiego kodu, przejdź do strony Wygląd ” Widżety z panelu bocznego administratora WordPress.

Następnie przewiń w dół do karty „Stopka” i rozwiń ją.

W tym poradniku używamy motywu Hestia Pro. W zależności od używanego motywu, twoja strona z widżetami może wyglądać nieco inaczej.

Następnie należy kliknąć przycisk „Dodaj blok” (+) w lewym górnym rogu ekranu i poszukać bloku Krótki kod.

Po jego znalezieniu dodaj blok do karty „Stopka”, a następnie wklej do niego krótki kod WPCode.

Add shortcode into the footer tab

Na koniec kliknij przycisk „Aktualizuj” u góry, aby zapisać twoje zmiany.

Teraz użytkownik może przejść na twoją witrynę internetową, aby sprawdzić dynamiczną datę praw autorskich w działaniu.

Preview for dynamic copyright date in WordPress footer

Dodawanie dynamicznej daty praw autorskich w motywie blokowym

Jeśli korzystasz z motywu opartego na blokach na twojej witrynie internetowej WordPress, możesz użyć tej metody, aby dodać krótki kod praw autorskich do stopki.

Najpierw należy przejść na stronę Wygląd ” Edytor z kokpitu WordPress. Spowoduje to uruchomienie pełnego edytora witryny na twoim ekranie.

Z tego miejsca wybierz sekcję Stopka, a następnie kliknij przycisk „Dodaj blok” (+) w lewym górnym rogu ekranu.

Następnie wystarczy znaleźć i dodać blok krótkiego kodu do twojego preferowanego obszaru w stopce.

Gdy to zrobisz, wklej dynamiczny krótki kod daty praw autorskich do bloku.

Add copyright date shortcode into the FSE

Na koniec nie zapomnij kliknąć przycisku „Zapisz” u góry, aby zapisać twoje ustawienia.

Użytkownik może teraz przejść na twoją witrynę internetową, aby sprawdzić dynamiczną datę praw autorskich w działaniu.

Copyright date in fse

Jeśli nie chcesz używać kodu na twojej witrynie internetowej, to ta metoda jest dla ciebie.

Najpierw należy zainstalować i włączyć wtyczkę Smart Copyright Year. Aby uzyskać szczegółowe informacje, warto zapoznać się z naszym przewodnikiem na temat instalacji wtyczki WordPress.

Po włączaniu, wtyczka automatycznie pobierze dane dla twojej daty praw autorskich. Należy pamiętać, że wtyczka wyświetla tylko obecny, aktualny rok i nie pokazuje zakresu lat, w których witryna była używana.

Aby wyświetlić datę praw autorskich, należy teraz dodać krótki kod do stopki witryny internetowej.

Dodawanie dynamicznej daty praw autorskich w klasycznym motywie

Jeśli używasz klasycznego motywu, który nie korzysta z pełnego edytora witryny, możesz skorzystać z tej metody.

Najpierw należy przejść na stronę Wygląd ” Widżety z panelu bocznego administratora WordPress. Gdy już tam będziesz, przewiń w dół do karty „Stopka” i rozwiń ją.

W tym poradniku używamy motywu Hestia Pro, więc twoje widżety mogą wyglądać nieco inaczej w zależności od używanego motywu.

Następnie kliknij przycisk „Dodaj blok” (+) w lewym górnym rogu ekranu i znajdź blok Krótki kod.

Wystarczy dodać blok do karty „Stopka”, a następnie skopiować i wkleić do niego poniższy krótki kod, aby wyświetlić datę praw autorskich w ten sposób:

[rok]

Add plugin shortcode in the footer widget

Na koniec kliknij przycisk „Aktualizuj” u góry, aby zapisać twoje zmiany.

Teraz użytkownik może przejść na twoją witrynę internetową, aby sprawdzić dynamiczną datę praw autorskich w działaniu.

Copyright date preview

Dodawanie dynamicznej daty praw autorskich w motywie blokowym

Jeśli korzystasz z motywu opartego na blokach z pełnym edytorem witryny, możesz wstawić dynamiczny krótki kod praw autorskich za pomocą tej metody.

Musisz udać się na stronę Wygląd ” Edytor z panelu bocznego administratora WordPress.

Gdy już się tam znajdziesz, wybierz sekcję „Stopka”, a następnie kliknij przycisk „Dodaj blok” (+) w lewym górnym rogu ekranu. Następnie wyszukaj i dodaj blok Krótki kod.

Następnie dodaj następujący krótki kod do bloku, aby wyświetlić datę praw autorskich na twojej witrynie internetowej:

[rok]

Add plugin shortcode

Na koniec kliknij przycisk „Zapisz” u góry, aby zapisać twoje ustawienia.

Teraz użytkownik może przejść na twoją witrynę internetową, aby zobaczyć dynamiczną datę praw autorskich w działaniu.

Copyright date preview with plugin

Mamy nadzieję, że ten artykuł pomógł ci dowiedzieć się, jak dodać dynamiczne daty praw autorskich w stopce WordPress. Możesz również zapoznać się z naszym poradnikiem na temat dodawania dynamicznych treści w WordPress ie i naszymi najlepszymi wtyczkami do WordPressa, które pomogą ci rozwinąć twoją witrynę.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Ujawnienie: Nasze treści są wspierane przez czytelników. Oznacza to, że jeśli klikniesz na niektóre z naszych linków, możemy otrzymać prowizję. Zobacz jak WPBeginner jest finansowany, dlaczego to ma znaczenie i jak możesz nas wspierać. Oto nasz proces redakcyjny.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Najlepszy zestaw narzędzi WordPress

Uzyskaj BEZPŁATNY dostęp do naszego zestawu narzędzi - zbiór produktów i zasobów związanych z WordPressem, które każdy profesjonalista powinien mieć!

Reader Interactions

54 komentarzeZostaw odpowiedź

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Armando says

    In this article, you are recommending the Auto Copyright Year Updater plugin, but according to WordPress.org, „This plugin hasn’t been tested with the latest 3 major releases of WordPress. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.”

    Do you have another recommendation? Thanks.

  3. Jiří Vaněk says

    Thank you for the article. I only had a tag for the current year on the site, but thanks to your snippet I was able to expand it to include the year the blog started. It looks much better. Good job. Thank you for this little thing, which I would not have figured out on my own, or I would have searched for it for a long time on the Internet and tried different codes.

  4. Moinuddin Waheed says

    Thanks for the code to add for having dynamic date in the copyright.
    it will eliminate the need to manually change the date.
    I was looking for this and will add to my websites.

  5. Yvon says

    I tried to do this as recommended in https://www.wpbeginner.com/glossary/functions-php/): I pasted the code as a snippet in the Code snippet plugin. But I’m not sure what to do next: „add the following code to your theme’s footer.php file where you want to display the date: ”
    I guess I don’t understand how the Code snippet plugin works: where the code is added / how do I address 'footer.php’>? I tried to just paste the code in the footer, but that didn’t work… Please help this coding-newbie?

  6. Zee Aitch says

    I think we should not waste time reinventing the wheel our self, instead utilizing the available plugins like Automatic Copyrights Shortcode.

    What you think?

    • WPBeginner Support says

      That plugin was not available when this post was created, we will certainly take a look at it

      Administrator

  7. Def Egge says

    I gave this a try and, for a moment, it appeared to work.

    Clearing the WP cache and reloading the page resulted in the same old „Blah … blah … blah … | Proudly powered by WordPress” footer.

    I no longer see this code snippet in the functions.php file for the ComicPress theme.

    Does it matter WHERE in the functions.php and footer.php files the code snippets are added? If so, it would be a great help to know that.

    Thanks!

  8. Kori says

    Does it have to be a child theme for this to stay in place? I’m on Twenty Seventeen, with no child theme. Do I need to worry about this being overwritten every time I get a WP udpate?

    Appreciate the help so much!

  9. Anna says

    Could someone assist with information on how to add a text after the year? Where in the code should this be placed?

  10. Rishabh says

    After i clicked save on the functions.php. I’m facing a white-screen of death. I also dowloaded the functions.php file but couldn’t find your code there. How do i solve it?

  11. Nikhil says

    I need to change ” Last updated on January 5th, 2016 by Editorial Staff ” this date with current date…

    So which command I have to use…. I had tried this one…

    But I’m getting the same date…

  12. gumusdis says

    Thanks! this is great, i used it on my website
    I added a post for 1 year ago, like 2015 to have more than 1 year. then I realized I could simply write down 2015 in code lol..
    anyway i hope you laughed..

  13. Kyle says

    This is WordPress Beginner!!! Why Don’t You tell the guys where exactly to put the code on PHP file? See lots of people breaking their websites so I would rather not try.

  14. lena woods says

    I added the code to functions, and it completely wiped out my website. Blank screen – when i go to login page and when i simply type in my website URL. what happened? did exactly what was said tot do above :/

  15. Christina says

    Great share,
    thanks a lot. I have searched so long how to remove the copyright in wordpress.

    Greets Christina

  16. Mark Roth says

    I have spent hours over several days trying to find the answer to the following need:

    A blogger’s copyright info is included automatically with each post. The blogger got married and changed her last name. How to get WordPress to use old name in copyright line for posts before wedding date and new name in copyright line for posts after the wedding date?

    I know get_the_date is key, but I don’t know how to write a conditional statement that says if post publication date is before October 1 2009, display maiden name, else display married name.

    (Or, of course, if post publication date is after wedding date, display married name.)

    I’m hoping one of you here will help me with this. Please?

  17. Michaela says

    Hi, I tried to update the functions.php file, but instead I received 500 Error. What shall I do? It does not allow me to access my wordpress account to edit it back…. can you please help me?

  18. Mirco says

    You can also try the Copyright Shortcodes plugin (it’s on the WordPress plugin directory).

    Available shortcodes are: [copyright year=YYYY], [copy], [year], [years by=YYYY list=true/false sep=“, “]

    Cheers,

  19. Brandon Hann says

    This is the code I used for a long time until I realized that the year is pulled based off of GMT, so if you don’t want users in different time zones to see your site’s year change early or late, don’t use this tag…change echo date to echo date_i18n

    For example, when I used the original code, I went to my website on Dec 31st, 2014 at around 6pm PST. My website was already showing the year 2015 because Pacific Standard Time is 8 hours behind GMT.

    With the date_i18n change, your site will show the current year based on the visitor’s timezone instead. For those that are curious, i18n is an abbreviation of „internationalization” because there are 18 letters between the 'I’ and the 'N’.

  20. hayward says

    I am having trouble with adding the code to my function.php footer. Now I am getting this error message Parse error: syntax error, unexpected 'function’ (T_FUNCTION) in /home3/hsp1990/public_html/wp-content/themes/couponpress/functions.php on line 35

    • Rex AZ says

      You should use a child theme rather than working with your parent theme. Just go over to the wordpress codex and source for child theme development. Just create a new functions.php file and a footer.php file in your child theme directory and insert the codes. You are good to go.

  21. Chris says

    Hi,
    how can I modify this code, so that I can have a fix „first date” of „1999”, instead of the date of the first published posting?
    Thanks.

  22. menj says

    I have used the code above, with a slight modification to the comicpress_copyright() function which I renamed to a more generic one.

  23. jrstaples1 says

    Nice tip! I addded this with almost zero coding knowledge. How would I add my site title after the year?

  24. Dominic says

    Something like this might be easier and less intensive.

    <?php
    $year = date('Y');
    if ($year != 2009){
    echo '© 2009 – '.$year.' YourSite.com';
    } else {
    echo '© 2009 YourSite.com';
    }
    ?>

  25. Gary says

    It’s worth pointing out that copyright exists for a number of years from the first time it was published. That means there’s to things to consider:

    1) The visual copyright notice is not necessary under the Berne treaty – it has no standing in law whether you have it on the site or not.

    2) If the site was first published in a certain year, claiming it could be actually published in a later year actually lowers any claim you may have for copyright infringement.

    Also, most visual copyright notices, for what they are worth, also need to put who the copyright is to, after the year(s).
    Finally, it’s typographically correct to use an „en dash” instead of the hyphen-minus character you’ve suggested.

  26. Derek Jensen says

    It surely does bug me when I go to a site and the copyright is out of date but yet they are publishing fresh content.

    This will be a nice dummy factor for that.

    As always I enjoy your guys as a WordPress resource.

Zostaw odpowiedź

Dziękujemy za pozostawienie komentarza. Pamiętaj, że wszystkie komentarze są moderowane zgodnie z naszymi polityka komentarzy, a Twój adres e-mail NIE zostanie opublikowany. NIE używaj słów kluczowych w polu nazwy. Przeprowadźmy osobistą i konstruktywną rozmowę.