php - 如何将我的外部 css 文件包含到我的插件中

标签 php css wordpress plugins

如何将外部 CSS 文件包含到我的插件中?我在谷歌上搜索了很多时间,但没有任何效果:((

Wordpress 插件,用 PHP 编写

函数字段(){ echo '

    <div class="DodajWpis"> <h1> Dodaj wpis </h1> </div> 
    <form method="post" id="#form" action="" enctype="multipart/form-data">

        <label class="katalogLabelName" for="name">Nazwa</label>
        <input class="Input" id="name" type="text" style="width:50%;" name="nazwa" required>

        <label class="katalogLabelName" for="tytul">Tytul</label>
        <input class="Input" type="text" style="width:50%;" name="tytul">

        <label class="katalogLabelName" for="maincategory">Kategoria</label>
        <input class="Input" type="text" style="width:50%;" list="maincategory" name="maincategory">
        <datalist id="maincategory" required>';
            $args = array('show_option_none' => 'No Category','hide_empty' => 0);
            $kategorie = get_categories( $args );
            foreach ( $kategorie as $category ) :
                echo '<option value="' .$category->name . '">' . $category->name . '</option>';
            endforeach;
        echo  '</datalist>  

        <label class="katalogLabelName" for="location">Lokalizacja</label>
        <input class="Input" type="text" style="width:50%;" list="location" name="location">
        <datalist id="location" required>';
            //$args = array('show_option_none' => 'No Category','hide_empty' => 0);
            $lokalizacja = get_categories(array('taxonomy=>location'));
            foreach ( $lokalizacja as $term ) :
                echo '<option value="' .$term->name . '">' . $term->name . '</option>';
            endforeach;
        echo  '</datalist>  


        <label class="katalogLabelName"  for="slowa_kluczowe">Slowa kluczowe (Limit to '.returnme('slowa_klucz_limit').')</label>
        <input class="Input" type="text" style="width:50%;" name="slowa_kluczowe" id="slowa_kluczowe" required>

        <label class="katalogLabelName"  for="email">Adres e-mail</label>
        <input class="Input" type="email" style="width:50%;" name="email" id="email">

        <label class="katalogLabelName"  for="website">Adres strony internetowej</label>
        <input class="Input" type="url" style="width:50%;" id="website" name="website" required>

        <label class="katalogLabelName" for="miasto">Miasto</label>
        <input class="Input" type="text" style="width:50%;" name="miasto" id="miato">


        <input class="Wyslij" type="file" id="async-upload" name="html-upload" accept="image/png, image/jpeg" required >
        <br> 

        <label class="katalogLabelName"  for="textarea">Opis</label>
        <textarea id="textarea" style="width:50%;" name="opis" required></textarea>
        <input type="submit" value="wyslij" class="button">

    </form>
';

}
add_shortcode('form', 'fields');

如何添加外部CSS文件?

最佳答案

你可以试试把这个放在echo之后` <link rel="stylesheet" href="https://example.com/css/style.css">

<link rel="stylesheet" href="https://example.com/css/style.css">

    <div class="DodajWpis"> <h1> Dodaj wpis </h1> </div> 
    <form method="post" id="#form" action="" enctype="multipart/form-data">

        <label class="katalogLabelName" for="name">Nazwa</label>
        <input class="Input" id="name" type="text" style="width:50%;" name="nazwa" required>

        <label class="katalogLabelName" for="tytul">Tytul</label>
        <input class="Input" type="text" style="width:50%;" name="tytul">

        <label class="katalogLabelName" for="maincategory">Kategoria</label>
        <input class="Input" type="text" style="width:50%;" list="maincategory" name="maincategory">
        <datalist id="maincategory" required>';
            $args = array('show_option_none' => 'No Category','hide_empty' => 0);
            $kategorie = get_categories( $args );
            foreach ( $kategorie as $category ) :
                echo '<option value="' .$category->name . '">' . $category->name . '</option>';
            endforeach;
        echo  '</datalist>  

        <label class="katalogLabelName" for="location">Lokalizacja</label>
        <input class="Input" type="text" style="width:50%;" list="location" name="location">
        <datalist id="location" required>';
            //$args = array('show_option_none' => 'No Category','hide_empty' => 0);
            $lokalizacja = get_categories(array('taxonomy=>location'));
            foreach ( $lokalizacja as $term ) :
                echo '<option value="' .$term->name . '">' . $term->name . '</option>';
            endforeach;
        echo  '</datalist>  


        <label class="katalogLabelName"  for="slowa_kluczowe">Slowa kluczowe (Limit to '.returnme('slowa_klucz_limit').')</label>
        <input class="Input" type="text" style="width:50%;" name="slowa_kluczowe" id="slowa_kluczowe" required>

        <label class="katalogLabelName"  for="email">Adres e-mail</label>
        <input class="Input" type="email" style="width:50%;" name="email" id="email">

        <label class="katalogLabelName"  for="website">Adres strony internetowej</label>
        <input class="Input" type="url" style="width:50%;" id="website" name="website" required>

        <label class="katalogLabelName" for="miasto">Miasto</label>
        <input class="Input" type="text" style="width:50%;" name="miasto" id="miato">


        <input class="Wyslij" type="file" id="async-upload" name="html-upload" accept="image/png, image/jpeg" required >
        <br> 

        <label class="katalogLabelName"  for="textarea">Opis</label>
        <textarea id="textarea" style="width:50%;" name="opis" required></textarea>
        <input type="submit" value="wyslij" class="button">

    </form>

关于php - 如何将我的外部 css 文件包含到我的插件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56233281/

相关文章:

php - 如何使用 PHP 从动态增加的表单字段中将信息保存到数据库?

php - 在 PHP 中显示空格后的文本

php - 在 PostgresQL 上保存之前压缩字符串是否有值(value)?

css - 在图像链接悬停时取消隐藏另一个 div

php : Problems getting the current session id or mysqli_insert_id()

javascript - 单击时显示 div,几秒钟后再次隐藏

jquery - 如何通过 jquery 从 html 编辑 .css 文件

html - bootstrap 和 wordpress - 3 列相同的高度

javascript - 在 href 100% 高度下制作图片

php - 在切换旁边添加 "MENU"(文本)?