Please select To the mobile version | Continue to access the desktop computer version

Nujin

 Forget password?
 Register

WeChat login, one step

View: 2074|Reply: 50

Students who develop wordpress themes know that wordpress corporate themes generally...

[Copy this link] Choose your language

3595

Threads

710k+

Posts

3670

Credits

白领

Rank: 4

Credits
3670
Post time 2021-1-28 15:47:19 | Show all posts |Reading mode


    The students who developedwordpress themeknow that wordpress corporate themes usually have many page pages, such as: About us, company profile, contact us, etc. As a customer, I want to call the relevant information of these page pages on the homepage of the wordpress corporate theme or somewhere else, such as: page title, page content, etc. What should I do? That is, how does the wordpress theme call the information of the specified page?
    If you know the ID of the specified page, you can directly use get_post($page_id) to call the content of the specified page, such as:
    1. $post=get_post(4854);
    2. echo $post->post_content; //内乱容
    3. echo $post->post_title;//题目
    Copy the Code
    However, the above method is not very friendly, because the ID of the page is sometimes not fixed unless it is your own site. If you are developing a wordpress corporate theme for other customers, you know them What is the ID of a certain page? This will be a big question mark.
    So, in most cases, we will get the relevant information of the page through the title of the page, the code is as follows:


      The first step: Get the page ID through the page title:
      function get_page_ID($pageName) {
      global $wpdb;
      $pages=get_pages();
      for($i=0; $ipost_title)$page_slug=$pages[$i]->post_name;//Acquire[page alias]according to[page name]
      }
      if($page_slug) {//Acquire[page ID]according to[page alias]
      $page_ID=$wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name='".$page_slug. "'AND post_status='publish' AND post_type='page'");
      return $page_ID;
      } else {
      return false;
      }
      }
      Step 2: Use the obtained page ID to obtain page information:
      $page_id =get_page_ID('About Us'); //Get ID
      $post=get_post($page_id );
      Through the above two parts, we have obtained the relevant information of this "About Us" page, and then use this$postobject to obtain the page content and other information. It can be seen that the method of obtaining page information in the wordpress corporate theme is more flexible, depending on how you choose. In fact, we can also create a specific page when the wordpress corporate theme is enabled, and an alias will be created directly when creating it, and we can directly call the page information through the alias.


Reply

Use magic Report

3432

Threads

710k+

Posts

3613

Credits

白领

Rank: 4

Credits
3613
Post time 2021-1-28 15:47:20 | Show all posts
要离开My女孩总对我说一句话:你是个好人,我配不上你~~OH!Mygod!
Reply Agree Disagree

Use magic Report

3649

Threads

710k+

Posts

3654

Credits

白领

Rank: 4

Credits
3654
Post time 2021-1-28 15:47:25 | Show all posts
一山不能容二虎,除非一公和一母!
Reply Agree Disagree

Use magic Report

3614

Threads

710k+

Posts

3615

Credits

白领

Rank: 4

Credits
3615
Post time 2021-1-28 15:47:26 | Show all posts
要在实践的荒野,没有早一步,也没有晚一步,于千万人中去邂逅自己的爱人,那是太难的缘分,世界上有太多的擦肩而过,更多的时候,我们只是在彼此不断的错过,错过鲜花烂漫的春,又错过了枫叶瑟索的秋,直到漫天白雪,年华不再,在一次次的辛酸感叹之后,才能终于了解——即使真挚,即使两个人都已是心有戚戚,我们的爱,依然需要时间来成全和考验。这世界有着太多的这样的限制与隐秘的禁忌,又有太多难以预测的变故和身不由己的离合,一个转身,也许就已经一辈子错过,要求奥道很多年以后,才会参透所有的争取与努力,也许还抵不果命运开的恶一个玩笑,上帝只在云端一眨眼,所有的结局,就都已经完全改变。”
Reply Agree Disagree

Use magic Report

3549

Threads

710k+

Posts

3656

Credits

白领

Rank: 4

Credits
3656
Post time 2021-1-28 15:47:30 | Show all posts
哈你逗逗他啊
Reply Agree Disagree

Use magic Report

3827

Threads

710k+

Posts

3660

Credits

白领

Rank: 4

Credits
3660
Post time 2021-1-28 15:47:31 | Show all posts
学校的男女厕所相连。一女生去厕所忘记带卫生纸,正在难堪时,隔壁男卫生间传来卫生纸,女生花容失色,大声地问“谁?”。隔壁男生低沉有力地答:“雷锋。”
Reply Agree Disagree

Use magic Report

3827

Threads

710k+

Posts

3660

Credits

白领

Rank: 4

Credits
3660
Post time 2021-1-28 15:47:31 | Show all posts
给老师或者领导留下好印象,他们不会在你沉沦时再Sink你几脚,相反可能会拉你一把。在社交中,原则是跌停股,世俗是潜力股。
Reply Agree Disagree

Use magic Report

3578

Threads

710k+

Posts

3665

Credits

白领

Rank: 4

Credits
3665
Post time 2021-1-28 15:47:35 | Show all posts
再看
Reply Agree Disagree

Use magic Report

3561

Threads

710k+

Posts

3663

Credits

白领

Rank: 4

Credits
3663
Post time 2021-1-28 15:47:43 | Show all posts
伟人之所以伟大,是因为他与别人共处逆境时,别人失去了信心,他却下决心实现自己的目标。
Reply Agree Disagree

Use magic Report

3627

Threads

710k+

Posts

3653

Credits

白领

Rank: 4

Credits
3653
Post time 2021-1-28 15:47:45 | Show all posts
曾经相遇,曾经相拥,曾经在彼此生命中光照,即使无缘也无憾
Reply Agree Disagree

Use magic Report

 
Online Customer Service
点击这里给我发消息
Technical Advisory Hotline
Wechat:gwailee
QQ:395508196
EM:hi@niuresou.com

Scan WeChat, follow the public account to lead Nujinniu Stock Niu Ce

QQ|Baidu Statistics|Archives|Mobile|Black House|Search management|Game management|Nujin ( ICP证:沪B2-20210491 | ICP备案号:沪ICP备20013403号 ) Choose your language

GMT+8, 2021-6-23 10:11 , Processed in 4.717074 second(s), 3966 queries .

Powered by Nujin X3.4

© 2001-2017 Nujin Inc.

Quick reply To Top Back to list