• Resolved sajonara

    (@sajonara)


    Hallo.

    Ich erstelle ein WordPress Thema, das AMP nutzt. Ich verzichte dabei auf wp_head und wp_footer.

    Gibt es eine Möglichkeit, das Pixel von Hand auszugeben?

    In einem Beitrag hier im Forum von vor 5 Jahren fand ich einen action hook der wp_footer nutzt. Nur würde ich Änderungen am Plug-in vornehmen, dann gingen die bei jedem Update verloren.

    Ich fand auch noch nen anderen Beitrag, indem was von WPVG::get_instance stand. Aber da bekomme ich dann lediglich den Hinweis/Fehler, dass die Klasse nicht eingebunden ist.

    Vielen Dank schon einmal für die Hilfe

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Dr. Ronny Harbich

    (@raubvogel)

    wordpress\wp-content\plugins\wp-vgwort\main.php:

    /**
    	 * Gets the VG WORT marker string for a specified post (if available, post type allowed, post author allowed and not disabled).
    	 * It is possible to filter the output:
    	 * add_filter('wp_vgwort_frontend_display', 'my_frontend_display_filter', 10, 5);
    	 * /**
    	 * * Gets the VG WORT marker string for the current post (if available, post type allowed, post author allowed and not disabled).
    	 * *
    	 * * {AT}param string $html The marker as HTML.
    	 * * {AT}param array $marker The marker object. Please inspect for details.
    	 * * {AT}param bool $use_tls True if TLS is used, otherwise false.
    	 * * {AT}param bool $lazyLoadMarker True if marker will be load lazy (by javascript), otherwise false.
    	 * * {AT}param bool $is_amp True if the marker will be output for AMP pages, otherwise for normal WordPress pages.
    	 * * {AT}param WP_Post|null $post The post to get the marker for. If null, the current post will be considered.
    	 * *
    	 * * {AT}return string A custom VG WORT marker string that will be output in the corresponding web page. Should be HTML.
    	 * * {add missing PHP doc end of comment "/" here}
    	 * function my_frontend_display_filter($html, $marker, $use_tls, $lazyLoadMarker, $is_amp, $post)
    	 * {
    	 *     return ('VG-Wort-Marke: ' . $html);
    	 * }
    	 *
    	 * @param bool $is_amp If true, the marker string will be output for AMP pages, otherwise for normal WordPress pages.
    	 * @param bool $is_feed If true, the marker string will be output for feed (RSS/ATOM), otherwise for normal WordPress pages.
    	 * @param WP_Post|null $post The post to get the marker for. If null, the current post will be considered.
    	 * @param bool $disable_lazy_loading If ture, lazy loading will be disabled in any case, otherwise false.
    	 *
    	 * @return string The VG WORT marker as defined in the output format setting (at settings page).
    	 * @throws Exception
    	 */
    	public function get_marker( $is_amp = false, $is_feed = false, WP_Post $post = null, $disable_lazy_loading = false ) {…}

    oder

    /**
     * Returns the VG WORT marker data for a specified post (only if available, post type allowed and post author allowed).
     *
     * @param WP_Post|null $post The post to get the marker for. If null, the current post will be considered.
     *
     * @return array|bool An array with marker data or false if no marker was found or the current query is not a single post or page.
     * @throws Exception
     */
    public function get_marker_data( WP_Post $post = null ) {...}

    Die Instanz der main-Klasse erhalten Sie über :

    WPVGW_Main::get_instance();

    Ggf. muss noch ein require_once(…) für die Klasse/Datei mit in den Theme-Code.

    Hilft das schon?

    Schöne Grüße!

    Thread Starter sajonara

    (@sajonara)

    Vielen Dank für die Antwort,

    also ich hab es anders gemacht und von Hand nach den Metadaten geschaut und gebe sie dann entsprechend aus, wenn son Pixel dann im Artikel ist, also baue es quasi von Hand.

    Aber ich denk die Antwort hier kann dann als Lösung für Leute gelten, die ein ähnliches Problem haben.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘(AMP-)Pixel in eigenem Theme einbinden’ is closed to new replies.