【问题标题】:add url to wordpress with php使用 php 将 url 添加到 wordpress
【发布时间】:2017-05-26 13:18:37
【问题描述】:

这是我的作品集http://portfolio1426.zzz.com.ua/。在“投资组合”部分,我添加了我的一个站点。如果您按下“查看”​​按钮,您可以看到项目的标题和描述。还有一个链接“网站在这里”。如果您按下它,该链接不会将您重定向到该站点,而是重定向到 id 为 'http://portfolio1426.zzz.com.ua/#work_0' 的页面。我无法更改我的 html 代码,或者当我添加 <a href ='http://ovk.zzz.com.ua/ovk/'> site here </a>

在描述中它也不起作用。我知道问题出在我的 PHP 代码中,但我不明白错误是什么。 这是我的 PHP 代码:

`

    所有作品 网站 同名 标志
                <?php if ( have_posts() ) : query_posts('cat=7');
                    while (have_posts()) : the_post(); ?>


                        <div class="mix col-md-3 col-sm-6 col-xs-6 portfolio_item <?php
                        $tags = wp_get_post_tags($post->ID);
                        if ($tags) {
                            foreach($tags as $tag) {
                                echo ' ' . $tag->name;
                            }
                        }
                        ?> ">
                            <?php the_post_thumbnail(array(600, 600)); ?>
                            <div class="port_item_cont">
                                <h3> <?php the_title(); ?></h3>
                                <?php the_excerpt(); ?>
                                 <a href="#" class="popup_content">Look at it
                                </a>
                            </div>

                            <div class="hidden">
                                <div class="podrt_descr">
                                    <div class="modal-box-content">
                                        <button class="mfp-close" type="button" title="Закрыть (Esc)">×</button>
                                        <h3><?php the_title(); ?></h3>
                                        <?php the_content(); ?>
                                       <img src="<?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
                                        echo $large_image_url[0];
                                        ?>" alt="<?php the_title(); ?>"/>
                                    </div>
                                </div>
                            </div>
                        </div>

                    <? endwhile; endif; wp_reset_query(); ?>


            </div>
        </div>
    </div>
</div>

`

请帮我解决这个问题。

【问题讨论】:

  • 该超链接是从 the_content() 生成的,您将在其中获得 Lorem Ipsum 和 &lt;a href="#work_1"&gt;ere&lt;/a&gt;,因此您需要直接在博客文章中编辑超链接 - 或者可能在不同的插件正在附加该内容。
  • 我尝试直接在博客文章中编辑超链接 - 它不起作用。我还安装了 2 个添加链接的插件 - 它们也不起作用:(
  • 我想我必须编辑我的 php 代码,但我不知道如何

标签: php html wordpress url


【解决方案1】:

看来 the_content() WordPress 函数正在删除 html 代码。 “此处的站点”链接未链接。

也许您的主题正在使用从帖子内容中删除 html 标签的过滤功能

【讨论】:

  • 好吧,我现在重新查看我的主题详细信息 :)
猜你喜欢
  • 1970-01-01
  • 2015-02-11
  • 2012-01-18
  • 2012-06-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多