
godrob
Members-
Posts
28 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
godrob's Achievements

Newbie (1/5)
0
Reputation
-
I just worked it out after you posted. Thanks anyway for taking the time to reply - appreciated!
-
Hi guys, I'm pretty new to PHP and could really do with some help please. All I want to do is wrap the code below in a simple IF statement. Basically it control the menu code which I want to hide on a certain page. <ul class="sf-menu"> <?php if ( has_nav_menu( 'primary-menu' ) ) { ?> <?php wp_nav_menu( array( 'container' => false, 'menu_id' => 'nav', 'theme_location' => 'primary-menu', 'items_wrap' => '%3$s' ) ); ?> <?php } else { ?> <?php wp_list_pages( 'title_li=&depth=3' . bp_dtheme_page_on_front() ); ?> <?php } ?> </ul> So I tried doing something like this: <?php if (is_page('Contact')) { // Disable Main Menu } else { <ul class="sf-menu"> <?php if ( has_nav_menu( 'primary-menu' ) ) { ?> <?php wp_nav_menu( array( 'container' => false, 'menu_id' => 'nav', 'theme_location' => 'primary-menu', 'items_wrap' => '%3$s' ) ); ?> <?php } else { ?> <?php wp_list_pages( 'title_li=&depth=3' . bp_dtheme_page_on_front() ); ?> <?php } ?> </ul> } ?> ...But I get an error: Parse error: syntax error, unexpected '<' on this line <ul class="sf-menu"> Anyone out there tell me what I'm doing wrong please? Many Thanks Rob
-
Redirect Non Logged In Users Except For Blog Posts
godrob replied to godrob's topic in PHP Coding Help
Don't worry, I've worked it out... I simply added !is_single() Easy when you know how -
Hi Guys, I'd be grateful if one of you could help me out here please? Basically the code below redirects non-logged in users to my login page unless they access a page specified in the array below. This all works just fine. However, what I'd also like to achieve is for non-logged in users to be able to access any blog posts, too. Any Wordpress guru's able to help me out here? <?php if(!is_user_logged_in() AND (!is_front_page() AND (!is_page( array (49, 57, 1796, 2017, 2951,686, 693, 675, 683, 689, 3063, 3477, 3649, 3989, 2576, 1773, 1784, 2700, 2706, 1791, 2709, 1778, 2703, 4115) ) ) ) ) { // wp_redirect('/index.php'); $redirect = home_url() . '/wp-login.php?redirect_to=' . urlencode( $_SERVER['REQUEST_URI'] ); wp_redirect( $redirect ); exit; } ?> Thanks for any help Rob.
-
Parse error: syntax error, unexpected T_LOGICAL_OR in
godrob replied to godrob's topic in PHP Coding Help
Thanks for your reply. Okay so if I modify my code to this: <?php if(current_user_can("access_s2member_level1") OR (!is_page( array( 100, 1773, 1791, 1778, 1784 ) ) ) ) { echo '<link type="text/css" rel="stylesheet" id="arrowchat_css" media="all" href="/arrowchat/external.php?type=css" charset="utf-8" />'; echo '<script type="text/javascript" src="/arrowchat/includes/js/jquery.js"></script>'; echo '<script type="text/javascript" src="/arrowchat/includes/js/jquery-ui.js"></script>'; } ?> The Javascript still shows when it shouldn't. However, if I isolate the code to just one query ie, use just current_user_can or !is_page , they work fine independently. What am I doing wrong? Thanks Rob. -
Hi Guys, I'm learning PHP and could do with some help with combining two conditions please. <?php if(!is_page( array( 100, 1773, 1791, 1778, 1784 ) ) ) OR (!current_user_can("access_s2member_level0")) { echo 'CONTENT TO SHOW'; } ?> When I try to access the page I get: Parse error: syntax error, unexpected T_LOGICAL_OR in ..... Any help appreciated Thanks Rob
-
.htaccess - Redirect Dynamic Profile Urls to Homepage
godrob replied to godrob's topic in Apache HTTP Server
Perfect! That worked. Appreciate your help with this, thank you! -
.htaccess - Redirect Dynamic Profile Urls to Homepage
godrob replied to godrob's topic in Apache HTTP Server
Cags, thank you so much... Yes, anything that has profile.php within the url should be redirected to the new homepage. so... do I simply need this: RewriteRule ^profile.php$ / [R=301,L] ...or am I missing something here? Appreciate your help with this Thanks Rob. -
.htaccess - Redirect Dynamic Profile Urls to Homepage
godrob replied to godrob's topic in Apache HTTP Server
Sorry I should have explained in more detail. I am building a new site on a new server and asking existing members of my old site to reregister on the new server. The CMS I'm using is totally diffferent, and so I wanted to redirect all old profile pages indexed by Google to the NEW homepage. Is this not really a good idea then? If it is viable can you please assist me with the code I need to achieve this? Regards Rob. -
Hi guys, I could really do with some help here please... I am replacing my website and need to redirect ALL urls that are this format: http://www.domain.com/profile.php?user=Fay123 to http://www.domain.com The profile name can be upper or lowercase and can consist of both characters and numbers. I have tried adding this to my .htaccess file: RewriteRule ^profile.php?user=(.*) http://www.domain.com ..but it doesn't work. Can any of you smart guys help me out here please. I have about 400 profiles indexed in Google that are don't want to lose. Thanks Rob
-
I fixed it... The variable was actually looking for a number not a string. Entering a 0 returned Anywhere Thanks for your help Rob.
-
Hi thanks for your reply. I've tried changing the code as per your suggestion, but I'm afraid it sill doesn't populate the database. Any ideas? Thanks for your help Regards Rob.
-
Hi Guys, Appreciate any help here please... Basically I want to hide some inputs on my registration page and populate them will default values. Everything works okay, apart from the input below: <input type="hidden" name="seek_location" value="Anywhere"> When I use the above, the MYSQL database field for seek_location is left empty... I've noticed that the code below pulls the location into a dropdown list. You know the kind of thing, Australia, UK, USA etc etc: $seek_location = $wcr[$seek_location]; <? $p=0;asort($wcr);reset($wcr); while (list ($p, $val) = each ($wcr)) { echo '<option value="'.$p.'">'.$val; } ?> So, all I want to do is have: <input type="hidden" name="seek_location" value="Anywhere"> Populate seek_location with Anywhere Any help appreciated Thanks Rob
-
Hi guys, I wonder if somebody can help me? When a user enters details about themselves into a textbox and includes an apostrophe, when the profile is pulled from the MYSQL database the apostrophe is replaced with a \' How can I get it so when the profile is viewed there is either no backslash Thanks for any help Regards Rob
-
Warning: date() expects parameter 2 to be long, string given in...
godrob replied to godrob's topic in PHP Coding Help
So if strtotime is causing the problem, then is it this line of code that is wrong? if(empty($_expires)){$_expires='n/a';}else{$_expires=date('d M Y', strtotime($_expires));} If so, can you please advise what it should read so that I do not receive the warning: Re: Warning: date() expects parameter 2 to be long, string given in... and also do no get the wrong date being posted as 31/12/1969 Thanks again for all of your help Regards Rob.