Can you change the value of the Bloginfo in the general-template of WordPress?

岁酱吖の 提交于 2019-12-25 18:39:05

问题


I am facing a great challenge, I am working on a site that has been converted from HTML into WordPress and I have the front-page displaying all the content right but not the other pages as the urls are not pointing correctly. I wonder if instead of changing manually all the URL from 150 pages there is a way that I change the main url path values in wp-includes/general-template.php from this:

    <?php  bloginfo('template_url');  ?>

into something like the real URL: http://example.com/

In other word by doing so, if successful, I will make only one change on the wp-includes/general-template.php and have all the broken links fixed...?

Anyone has a clue?

Many thanks all....(I am running out of time and options....help is greatly appreciated..:)

Daniele


回答1:


If I understand your question right, wordpress does not work like that, if you have broken links that point to incorrect domain you need to make the change from phpMyAdmin using this query to replace URLs:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl'); 

but make sure to change the table prefix, and do a search on the incorrect url in your database to know what tables have that url, then change table name and column in the query above based on your search.




回答2:


Found a way around by changing the wp-includes/general-template.php on line 693 from the following:

    case 'template_directory':
    case 'template_url':
        $output = get_template_directory_uri();

to the following:

    case 'template_directory':
    case 'template_url':
        $output = site_url( 'mising_url_path_here' );

now I have fixed all the broken link for js/images/other files and can be viewed.



来源:https://stackoverflow.com/questions/42174136/can-you-change-the-value-of-the-bloginfo-in-the-general-template-of-wordpress

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!