Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUESTION Get parent url Get specifig page title etc
#1
Theres is get_parent( $echo=true ) template tag, but is there a get parent url ?   Rolleyes
Reply
#2
I am not an expert in PHP, so I usually also ask questions on the forum. Here is the code I have in the file with the answers to my questions.
Code:
<?php
    global $parent;
    if ($parent) {
        echo '<a href="'. find_url($parent, returnPageField($parent, 'parent')). '">', returnPageField($parent, 'title'), '</a>';
    }
?>
Reply
#3
Thanx Oleg06 that works, yes i have to ask forums, my php is "nonexistent" but im learning a bit here and there as i go Big Grin.
Carlos snippet dont give parent url, it gives current page url.
Reply
#4
Ah yes, sorry.

I've removed my useless post.
Reply
#5
Heres more "how to" questions.
1. How to get specifig page title? like there is snippet for content getPageContent('slug');
2. How to get specifig page image if there is one?.
3. How to get specifig page url?.
Reply
#6
1. <?php getPageField('slug','title'); ?>
2. Depends on the plugin you're using to assign images to pages.
Reply
#7
(2019-04-11, 23:54:43)Carlos Wrote: 1. <?php getPageField('slug','title'); ?>
2. Depends on the plugin you're using to assign images to pages.

1 works thanx Big Grin.
2 no plugins just regular get simple page image
Reply
#8
(2019-04-12, 00:41:04)Riianna Wrote:
(2019-04-11, 23:54:43)Carlos Wrote: 1. <?php getPageField('slug','title'); ?>
2. Depends on the plugin you're using to assign images to pages.

1 works thanx Big Grin.
2 no plugins just regular get simple page image

2. Use Custom Fields plugin to add images for pages and code
Code:
<?php getPageField('slug', 'field_name'); ?>
to get image path

3. <?php getPageField('slug',url'); ?> - will this work?
Reply
#9
In fact all this work with the main language. How can we use <?php getPageField('slug','title'); ?> on multilanguage websites? So that we can have only one component?
Reply
#10
Making horror theme to friend and frontpage template has 3 boxes with some info from specifig pages like "who we are" etc. So i try to make it dead simple for him to add page title and page image to those boxes, like getting specifig page title with link and get specifig page image Big Grin
Reply




Users browsing this thread: 1 Guest(s)