简体   繁体   English

如何对另一个wordpress php文件做href?

[英]How to do a href to another wordpress php file?

i have a question, im working with wordpress, im using stackers a blank theme which im using to convert a html template to wordpress, so bassically im trying to make it work a href to a link of my website, for example, im doing a landing page, and i want a hiperlink or a button to redirect to another php file, for example localhost/wordpress/newpage, what is the correct way to tell wordpress hey i want you to carry me to this file ';what i need, i need to redirect from home.php to another file loading javascript and css styles similar as normal html hiperlink instancing, how can i achieve it using wordpress and raw code?我有一个问题,我正在使用 wordpress,我正在使用 stackers 一个空白主题,我用它来将 html 模板转换为 wordpress,所以基本上我试图让它工作一个 href 到我网站的链接,例如,我正在做一个登陆页面,我想要一个 Hiperlink 或一个按钮来重定向到另一个 php 文件,例如 localhost/wordpress/newpage,告诉 wordpress 嘿我希望你把我带到这个文件的正确方法是什么;我需要什么,我需要从 home.php 重定向到另一个加载 javascript 和 css 样式的文件,类似于普通的 html hiperlink 实例化,我如何使用 wordpress 和原始代码实现它? image here: image here图片在此:图片在此

file tree here: so you can make a idea of what im doing(bassically i copy pasted the html template in the home.php file, leaving header and footer quiet....文件树在这里:这样你就可以了解我在做什么(基本上我将 html 模板复制粘贴到 home.php 文件中,让页眉和页脚安静......

enter image description here在此处输入图片说明

loaded css and javascriph as usual using the functions.php像往常一样使用functions.php加载css和javascriph

add_action('wp_enqueue_scripts','theme_enqueue_styles');

 
function theme_enqueue_styles(){

#<!-- Bootstrap CSS -->
wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri().'/includes/css/bootstrap.min.css');
#<!-- Owl Carousel CSS -->
wp_enqueue_style( 'carousel', get_stylesheet_directory_uri().'/includes/css/owl.carousel.min.css');
#<!-- FONT AWESOME -->
wp_enqueue_style( 'fontawesome', get_stylesheet_directory_uri().'/includes/css/font-awesome.min.css');
#<!-- Custom styles for this template -->
wp_enqueue_style( 'stylemain', get_stylesheet_directory_uri().'/includes/css/style.css');
#<!-- Google Fonts -->
wp_enqueue_style( 'googlefonts', get_stylesheet_directory_uri().'/includes/css/googlefonts.css');
#<!-- Magnific Popup core CSS file -->
wp_enqueue_style( 'magnificpopup', get_stylesheet_directory_uri().'/includes/css/magnific-popup.css');
}




function enqueue_my_javascripts_scripts()
{
    wp_enqueue_script('jquery');
    wp_enqueue_script('magnificpopupinitialization', get_stylesheet_directory_uri().'/includes/js/magnificpopupinitialization.js', array('jquery'),false,true);
    #wp_enqueue_script('jquery', get_stylesheet_directory_uri().'/includes/js/jquery.min.js', array('jquery'),false,true); backup
    wp_enqueue_script('navbar', get_stylesheet_directory_uri().'/includes/js/navbar.js', array('jquery'),false,true);
    wp_enqueue_script('bootstrapjs', get_stylesheet_directory_uri().'/includes/js/bootstrap.min.js', array('jquery'),false,true);
    wp_enqueue_script('jquerycounto', get_stylesheet_directory_uri().'/includes/js/jquery.countTo.js', array('jquery'),false,true);
    wp_enqueue_script('my_script3', get_stylesheet_directory_uri().'/includes/js/jquery.min.js', array('jquery'),false,true);
    wp_enqueue_script('jquerytyper', get_stylesheet_directory_uri().'/includes/js/jquery.typer.js', array('jquery'),false,true);
    wp_enqueue_script('owlcarousel', get_stylesheet_directory_uri().'/includes/js/owl.carousel.min.js', array('jquery'),false,true);
    wp_enqueue_script('tiltkquerymin', get_stylesheet_directory_uri().'/includes/js/tilt.jquery.min.js', array('jquery'),false,true);
    wp_enqueue_script('mainjs', get_stylesheet_directory_uri().'/includes/js/main.js', array('jquery'),false,true);
    wp_enqueue_script('particles', get_stylesheet_directory_uri().'/includes/js/particles.js', array('jquery'),false,true);
    wp_enqueue_script('magnificpopup', get_stylesheet_directory_uri().'/includes/js/jquery.magnific-popup.min.js', array('jquery'),false,true);
    
}

add_action('wp_enqueue_scripts','enqueue_my_javascripts_scripts');

what i want is to use a button or a link to send me to another php page for example im on home.php and i want to go to > about_us how can i achieve it?我想要的是使用按钮或链接将我发送到另一个 php 页面,例如我在 home.php 上,我想去> about_us 我怎样才能实现它? im a rookie in wordpress so that is why im looking for assistance here,我是 wordpress 的新手,所以我在这里寻求帮助,

thank you everyone in foward谢谢大家前进

Correct answer is:正确答案是:

Use <a href="<?php echo site_url()?>/home">Read More</a>使用<a href="<?php echo site_url()?>/home">Read More</a>

Thank you very much @MinalChauhan非常感谢@MinalChauhan

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM