GetSimple Support Forum
Trying to implement Dynamic Page Titles - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Trying to implement Dynamic Page Titles (/showthread.php?tid=1546)



Trying to implement Dynamic Page Titles - nvinanda - 2011-04-09

Hey there,

I'm trying to get benefit from Custom Fields plugin to use dynamic titles on pages. Using custom fields, I've create a filed called "page=title" which automatically added to "Create Page" page.

Now If i put the title in the newly created field, the title works wonderfully but in some pages I forgot to write something in the custom field, no title is displayed.

Here is what I tried between <title> tags.

<?php
if (get_custom_field('page-title')) {
get_custom_field('page-title');
}
else {
get_page_clean_title();
}
?>

Note: I also tried using the "empty" tag.

In simple words, I need custom field (get_custom_field('page-title')) if available and simple title (get_page_clean_title() if custom field not available.


Trying to implement Dynamic Page Titles - mvlcek - 2011-04-09

nvinanda Wrote:In simple words, I need custom field (get_custom_field('page-title')) if available and simple title (get_page_clean_title() if custom field not available.

If you want to check the value, you have to use return_custom_field:

Code:
<?php
if (return_custom_field('page-title')) {
    get_custom_field('page-title');
} else {
    get_page_clean_title();
}
?>

BTW: Please post questions to plugins in the corresponding plugin's topic.


Trying to implement Dynamic Page Titles - nvinanda - 2011-04-10

Great! It worked.