Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
computer:wordpress:replace_yoast_seo_headers [2022/05/19 14:41] – angelegt springmcomputer:wordpress:replace_yoast_seo_headers [2022/05/19 16:30] (current) springm
Line 21: Line 21:
  
 Um Yoast SEO zu ersetzen, müssen diese Einträge aus der functions.php generiert werden. Dabei sollen die Inhalte dynamisch gemacht werden. Um Yoast SEO zu ersetzen, müssen diese Einträge aus der functions.php generiert werden. Dabei sollen die Inhalte dynamisch gemacht werden.
 +
 +Aus der Wordpress-Dokumentation:
 +  function themename_custom_header_setup() {
 +    $args = array(
 +        'default-image'      => get_template_directory_uri() . 'img/default-image.jpg',
 +        'default-text-color' => '000',
 +        'width'              => 1000,
 +        'height'             => 250,
 +        'flex-width'         => true,
 +        'flex-height'        => true,
 +    );
 +    add_theme_support( 'custom-header', $args );
 +  }
 +  add_action( 'after_setup_theme', 'themename_custom_header_setup' );
 +
 +Nützlicher (von https://wordpress.stackexchange.com/questions/293018/add-meta-tags-to-the-head-section-via-functions-php)
 +  // echo noindex tag if post or page has a "my_noindex" custom field with a value of "y"|"Y"|"yes" ...
 +  function my_meta_tags() {
 +   $noindex = (get_post_meta( get_queried_object_id(), 'my_noindex', true ));
 +   if (strtolower(substr($noindex,0,1)) == 'y') { 
 +     ?><meta name="robots" content="noindex" />
 +     <?php return; // noindex so no point in doing any other SEO stuff
 +   }
 +
 +   // other SEO stuff
 +
 +  }
 +  add_action( 'wp_head', 'my_meta_tags',2);
 +Siehe außerdem https://digwp.com/2013/08/basic-wp-seo/
  
  
  • computer/wordpress/replace_yoast_seo_headers.1652971263.txt.gz
  • Last modified: 2022/05/19 14:41
  • by springm