WP+PHPスニペット

/* --------------------------- パス, 呼出し --------------------------- */ <!-- 画像 --> <img src="<?php echo get_template_directory_uri(); ?>/assets/images/xxx.jpg" alt=""> <!-- ファイル --> <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/js/slick/slick-theme.css"/> <!-- 固定ページUR --> <a href="<?php $page = get_page_by_path('sitemap'); echo get_permalink($page->ID); ?>">サイトマップ</a> <!-- テンプレ呼び出し --> <?php get_template_part( 'tm-contact-link' ); ?> /* --------------------------- ナビ --------------------------- */ <!-- current付与 --> <?php if ( is_page('XXXX') ): ?> current<?php endif; ?> /* --------------------------- 条件分岐 --------------------------- */ <?php if ( is_front_page() || is_page('project') || is_page('company') || is_page('recruit') || is_page('contact') ): ?> 〜処理〜 <?php endif; ?> /* --------------------------- カスタムフィールド --------------------------- */ <!-- テキスト --> <?php if( get_field('cf__p-ep--name-02') ): /* データ有無判定 */ ?> <?php the_field('cf__p-ep--name-02') ?> <?php endif; ?> <!-- 画像 --> <?php if( get_field('cf__p-ep--img') ): /* データ有無判定 */ ?> <img src="<?php the_field('cf__p-ep--img'); ?>" alt="<?php the_field('cf__p-ep--name') ?>"> <?php endif; ?> /* --------------------------- IE -- lte --------------------------- */ <?php /* IE9-8で非表示 */ $agent = getenv("HTTP_USER_AGENT"); if( !mb_ereg("MSIE 9.", $agent) && !mb_ereg("MSIE 8.", $agent) ){ ?> <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/normalize.css"> <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/fonts.css"> <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/style.css"> <?php } ?> <?php /* IE9-8で表示 */ $agent = getenv("HTTP_USER_AGENT"); if( mb_ereg("MSIE 9.", $agent) or mb_ereg("MSIE 8.", $agent) or mb_ereg("MSIE 7.", $agent) ){ ?> <link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/ie-lte.css" media="all"> <?php } ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.