Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php WordPress-将模板位置传递到分页数组_Php_Wordpress_Svg_Pagination - Fatal编程技术网

Php WordPress-将模板位置传递到分页数组

Php WordPress-将模板位置传递到分页数组,php,wordpress,svg,pagination,Php,Wordpress,Svg,Pagination,我想传入一个svg箭头图像作为WordPress后期分页循环的上一个文本和下一个文本。目前,我已经硬编码了localhost URL。我想将其设置为使用get_template_directory_uri()或类似工具 当前代码: <?php $big = 999999999; echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big

我想传入一个svg箭头图像作为WordPress后期分页循环的上一个文本和下一个文本。目前,我已经硬编码了localhost URL。我想将其设置为使用get_template_directory_uri()或类似工具

当前代码:

<?php
  $big = 999999999;

  echo paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
     'format' => '?paged=%#%',
     'current' => max( 1, get_query_var('paged') ),
     'next_text' => ('<img class="next-arrow" src="http://localhost:8888/mockingbird/wp-content/themes/mockingbird/images/arrow.svg" alt="next posts"/>'),
     'prev_text' => ('<img class="prev-arrow" src="http://localhost:8888/mockingbird/wp-content/themes/mockingbird/images/arrow.svg" alt="previous posts"/>'),
     'total' => $query->max_num_pages
   ) );
?>

我想要的Psuedo代码如下:

'next_text' => ('<img class="next-arrow" src="<?php echo get_template_directory_uri(); ?>/images/arrow.svg" alt="next posts"/>'),
'prev_text' => ('<img class="prev-arrow" src="<?php echo get_template_directory_uri(); ?>/images/arrow.svg" alt="previous posts"/>'),
'next_text'=>('/images/arrow.svg“alt=”next posts“/>),
'prev_text'=>('/images/arrow.svg“alt=”previous posts“/>),
所以我的问题是,是否可以在数组的字符串中传入php


如果没有,我如何在URL中不进行硬编码就实现这一点?

找到了一个解决方案,将下一个文本和上一个文本设置为空字符串,然后将arrow.svg设置为css中下一个和上一个链接的背景图像

<?php
  $big = 999999999;

  echo paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'next_text' => (''),
    'prev_text' => (''),
    'total' => $query->max_num_pages
) );
?>
这样,我的图像url就是css中设置的相对路径

<?php
  $big = 999999999;

  echo paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'next_text' => (''),
    'prev_text' => (''),
    'total' => $query->max_num_pages
) );
?>