MichiPedia

Allgemeines

ToDo

  • Leaflet
    • Inline Style/HTML (leaflet css funktioniert im Augenblick nur, wenn sie direkt in Header eingefügt wird)
    • Pin Information at click event
  • Custom Post Type program
    • remove 'main_body_content' and place text in standard block
    • Need to enable ' editor' in 'register_post_type'
  • FallBack Standard Search - no JS

Logins / PWs / etc

wp_admin              wp                    wp
user                  kittydoe              wp
PHPmyAdmin            wordpress             wordpress

Funktionen

Loop

the_post()

the_permalink()

the_title()

#
# the_author_posts_link()
#
# Link zum Archive des Autors; Anzeige des Autornamens
# 
# http://localhost:8010/author/wp
#
# Default Anzeige "wp". 
# Definiert man einen "Öffentlichen Namen" in Benutzer wird dieser angezeigt.
#

the_author_posts_link();

#
# the_time()
#
# Liste der Formate:
#    https://codex.wordpress.org/de:Formatierung_von_Datum_und_Uhrzeit
# 

the_time( 'M j Y' );

#
# the_category() ???
# get_the_category() ???
#

echo get_the_category_list( ', ' );

#
# the_excerpt()
#

the_excerpt();

#
# Genauere Darstellung eines "Excerpts"
#
# if( has_excerpt() ) {
#    echo get_the_excerpt();
# }
# else {
#    echo wp_trim_words( get_the_content(), 18 );
# }
#

the_post_thumbnail('professorPortrait');

the_post_thumbnail_url('professorLandscape');
get_the_post_thumbnail_url(0, 'professorLandscape');   # post ID

echo paginate_links();

#
# the_archive_title() outputs 
#
#     Kategorie:Allgemein          # http://localhost:8010/category/allgemein
#     Autor: wp                    # http://localhost:8010/author/wp
#     Jahr: 2024                   # http://localhost:8010/2024
#     Monat: Januar 2024           # http://localhost:8010/2024/01
#     Tag: 19. Januar 2024         # http://localhost:8010/2024/01/19
#

the_archive_title();

#
# Alternativ: if Statement 
#
# 
# if( is_category() ) {             # Category Archive Page
#   single_cat_title();             # Displays or retrieves page title for
#                                   # category archive
# }
# if( is_author() ) {               # Author archive page
#    ...
# }

#
# Beschreibung des Archivs (z.B. Kategorie), sofern diese existiert
#
# Im Admin Menü in Kategorie
#
the_archive_description();

#
# get_post_type_archive_link()liefert Link zu Archiv
# Alternative zu echo site_url( '/events' ), das bei Custom Post Types
# geändert werden kann
#
echo get_post_type_archive_link( 'event' )

Loop Funktionen bei Advanced Custom Fields

#
# Event Date
#
# Returnwert definiert in Admin des ACF: Ymd --> 20240122
#
# Muss mit PHP ins korrekte Format gebracht werden
#
# $eventDate = new DateTime( get_field( 'event_date' ) );
# echo $eventDate->format('M');
#
the_field('event_date');
get_field('event_date')


#
# Background Image
#
# Daraus wird die URL benötigt
#
# $pageBannerImage = get_field( 'page_banner_background_image' );
# echo $pageBannerImage['url'];
#
the_field('page_banner_background_image');
get_field('page_banner_background_image');

Links - Parent / Child

# 
# http://localhost:8010/blog
#
echo site_url( 'blog' );

#
# Load Background Image
#
# http://localhost:8010/wp-content/themes/<THEME>/images/ocean.jpg
#
echo get_theme_file_uri( '/images/ocean.jpg' )

#
# ID des Parent Posts (oder NULL)
#
wp_get_post_parent_id( get_the_ID() );

Sonstige WP Funktionen

#
# sanitize_text_field()
#
# z.B. um das Search Feld in der URL bei der REST Abfrage abzusichern
#
sanitize_text_field( $data['term') );

#
# sanitize_textarea_field()
#
# z.B. um das Search Feld in der URL bei der REST Abfrage abzusichern
#
$data['term'] = sanitize_textarea_field( $data['term') );

#
# esc_url()   User Eingaben in der Adress Zeile
#
esc_url();

#
# esc_attr()     # Felder aus der Datenbank
#
esc_attr();

#
# esc_textarea()
#

#
# esc_html()    # Bei Eingabe von
#                 <script>alert("Hello");</script>
#               # ergibt
#                 <script>alert("Hello");</script>
#               # als Ausgabe, aber keine Ausführung
#
esc_html( get_the_content() );

wp_logout_url();

wp_login_url();

wp_registration_url();       # esc_url( site_url( '/wp-signup.php') );

#
# get_avatar(a, b)            # gravatar.com ???
#            a: User ID
#            b: Pixel
#
echo get_avatar(get_current_user_id(), 60);

get_current_user_id();

show_admin_bar();     # true / false

wp_strip_all_tags()      # HTML textarea; delete HTML ELements
                         +# used in My Notes Page

wp_localize_script()

wp_create_nonce()

#
# count_user_posts(a, b)
#                  a: User
#                  b: Postname
#
get_current_user_id( get_current_user_id(), 'note' );

Hooks

Wordpress Standard Hooks (zeitliche Reihenfolge)

muplugins_loaded
registered_taxonomy
registered_post_type
plugins_loaded
sanitize_comment_cookies
setup_theme
load_textdomain

#
# after_setup_theme
#
   add_theme_support()           # z.B. add_theme_support('title_tag')
   add_image_sizes()             # z.B. add_image_sizes('professorLandscape, 400, 250, true)

auth_cookie_malformed
auth_cookie_valid
set_current_user

#
# init                           # runs after WP has finished loading but before 
#                                # any headers sent. Generally used by plugins to 
#                                # initialize their process.
#    
   register_post_type()

#
# widgets_init                   # registers sidebars. Fires at 'init' with P1
#                                # before 'init' actions with priority ≥ 1!

register_sidebar

wp_register_sidebar_widget

#
# admin_init                     #  executed as the first action, when user access 
#                                # the admin section of WordPress
#
   wp_redirect()

wp_default_scripts
wp_default_styles
admin_bar_init

#
# wp_loaded
#
   show_admin_bar( false );

parse_request
send_headers
parse_query

#
# pre_get_posts                   # to customize the standard query in functions.php
#
# Attention: exclude standard queries that shall not be effected
# Read more:
#            https://codex.wordpress.org/Conditional_Tags
#            https://www.billerickson.net/code/wp_query-arguments/ (sehr gut!)
#            https://developer.wordpress.org/reference/classes/wp_query/
#
#            if( !is_admin() AND $query->is_main_query() AND is_post_type_archive('event')) {..}
#
   $query->set( '' )

posts_selection
wp
template_redirect
get_header

#
# wp_enqueue_scripts
#
   wp_enqueue_script()
   wp_enqueue_style()
   wp_localize_script()     # script muss vorher registriert sein
                            # Details siehe Wordpress/WP Functions

wp_head
wp_print_styles
wp_print_scripts
get_search_form
loop_start
the_post
get_template_part_content
loop_end
get_sidebar
dynamic_sidebar
get_search_form
loop_start
the_post
get_template_part_content
loop_end
get_sidebar
dynamic_sidebar
get_search_form
pre_get_comments
wp_meta
get_footer
get_sidebar
wp_footer
wp_print_footer_scripts
admin_bar_menu
wp_before_admin_bar_render
wp_after_admin_bar_render
shutdown

Wordpress Standard Hooks (undeterminiert)


#
# login_enqueue_scripts
#
   wp_enqueue_style();

REST

#
# rest_api_init
#
   register_rest_field()
   register_rest_route()

ACF (Advanced Custom Fields) Hooks

acf/fields/google-maps/api

Filters

#
# login_header_url     # die URL, die sich beim Login Screen hinter WP Logo verbirgt
#
   .... return( esc_url(site_url('/')) );

#
# login_headertitle
#
   ... return( get_blog_info('name') );

#
# wp_insert_post_data
#
# Passes more that one Argument
#
# In functions.php 
#
f( $data, $postarr ) {
   if( $data['post_type'] == 'note' AND ... ) {
      $data['post_status'] = 'private';
   }
}
add_filter( 'wp_insert_post_data', 'f', 10, 2 );

Sonstiges

&raquo;Beispiel&laquo;, »Beispiel«

Plugins

  • Regenerate Thumbnails
    • Suche: regenerate thumbnails
    • by Alex Mills
    • 1+ Million
  • Manual Image Crop
    • Suche: manual image crop tomasz
    • by Tomasz Sita
  • All-in-One WP Migration
    • Suche: all in one
    • by ServMask
    • Standard Accounts
      • UserName: admin Password: admin
      • UserName: guest Password: guest