How to position input fields horizontally and not vertically? - php

I have a wordpress register.php file from the buddyboss-platform(1.8.5).
And there are all input fields under each other, like this:
Lable Email
Input field email
lable password
input field password
But I want to have them next to each other. Like this
lable Email lable password
input field Email input field password
And of course I tried a lot. And googled a lot. But the input fields stay vertical and not horizontally
So this is the register.php file:
<?php
?>
<?php bp_nouveau_signup_hook('before', 'page'); ?>
<div id="register-page" class="page register-page">
<?php bp_nouveau_template_notices(); ?>
<?php bp_nouveau_user_feedback(bp_get_current_signup_step()); ?>
<form action="" name="signup_form" id="signup-form box" class="standard-form signup-form clearfix" method="post" enctype="multipart/form-data">
<?php if ('request-details' === bp_get_current_signup_step()) : ?>
<?php bp_nouveau_signup_hook('after', 'account_details'); ?>
<div class="register-section default-profile" id="basic-details-section">
<?php /***** Basic Account Details ******/ ?>
</div><!-- #basic-details-section -->
<?php bp_nouveau_signup_hook('after', 'account_details'); ?>
<?php /***** Extra Profile Details ******/ ?>
<?php if (bp_is_active('xprofile') && bp_nouveau_base_account_has_xprofile()) : ?>
<?php bp_nouveau_signup_hook('before', 'signup_profile'); ?>
<div class="register-section extended-profile" id="profile-details-section">
<?php /* Use the profile field loop to render input fields for the 'base' profile field group */ ?>
<?php while (bp_profile_groups()) : bp_the_profile_group(); ?>
<?php while (bp_profile_fields()) : bp_the_profile_field();
if (function_exists('bp_member_type_enable_disable') && false === bp_member_type_enable_disable()) {
if (function_exists('bp_get_xprofile_member_type_field_id') && bp_get_the_profile_field_id() === bp_get_xprofile_member_type_field_id()) {
continue;
}
}
?>
<div<?php bp_field_css_class('editfield');
bp_field_data_attribute(); ?> <fieldset>
<?php
$field_type = bp_xprofile_create_field_type(bp_get_the_profile_field_type());
$field_type->edit_field_html();
?>
</fieldset>
</div>
<?php endwhile; ?>
<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php bp_the_profile_field_ids(); ?>" />
<?php endwhile; ?>
<?php bp_nouveau_signup_form(); ?>
<?php bp_nouveau_signup_hook('', 'signup_profile'); ?>
</div><!-- #profile-details-section -->
<?php bp_nouveau_signup_hook('after', 'signup_profile'); ?>
<?php endif; ?>
</div><!-- //.layout-wrap -->
<?php bp_nouveau_signup_terms_privacy(); ?>
<?php bp_nouveau_submit_button('register'); ?>
<?php endif; // request-details signup step
?>
<?php bp_nouveau_signup_hook('custom', 'steps'); ?>
</form>
</div>
<?php bp_nouveau_signup_hook('after', 'page'); ?>
And I tried this in style.css
#box {
display: flex;
align-items: baseline;
}
#productSearch form input {
vertical-align: middle;
}
But that doesn't worked.
And A side note. I also saw in the downloaded buddyboss-platform that the register.php has after the closing </form> an ending </div>. But without opening div. Is that legal?
My question. What I have to change? So that the two fields will shown horizontal?

This is mostly a CSS issue as buddypress is applying its own style.
Try using this (if it doesn't work, apply a higher specificity):
#basic-details-section {
display: grid;
grid-template-columns: 1fr 1fr;
grid-column-gap: 14px;
}
Higher specificity #register-page #signup-form #basic-details-section

Related

PHP echo not outputting html tags

I'm trying to output content from an Advanced Custom Fields (ACF) in my wordpress theme. At the moment though, all I'm getting is the plain text content from the ACF inside double quotation marks, not inside the div and h1 tags.
The code is copied from another theme I made where it worked, which makes me think something is interfering with it somewhere?
<?php $process_title = the_sub_field('process_title'); ?>
<?php if(!empty($process_title)) : ?>
<div class="process-title">
<h1 class="process-heading">
<?php echo $process_title; ?>
</h1>
</div>
<?php endif; ?>
Thanks to #M.Eriksson, the correct code should be:
<?php $process_title = get_sub_field('process_title'); ?>
<?php if(!empty($process_title)) : ?>
<div class="process-title">
<h1 class="process-heading">
<?php echo $process_title; ?>
</h1>
</div>
<?php endif; ?>

Hide ACF fields when one of them are empty

i use the following code with custom fields:
But the problem is; when did not put any content in one of custom field it need be hide.
the class style of the other effect it, and that is something I don’t want to show.
<div class = "class2">
<? php the_sub_field ('filed2'); ?>
</div>
<div class = "class1">
<? php the_sub_field ('filed1'); ?>
</div>
I want hide one of both custom filed when on of them is empty.
How can i hide it?
<?php if (get_sub_field ('filed2') || get_sub_field('filed1'));{ ?>
<div class = "class2">
<? php the_sub_field ('filed2'); ?>
</div>
<div class = "class1">
<? php the_sub_field ('filed1'); ?>
</div>
<?php } ?>
You would want to wrap it in an if statement.
You can also do (if you need the conditional logic on a per-field basis):
<?php if (get_sub_field ('filed2'));{ ?>
<div class = "class2">
<? php the_sub_field ('filed2'); ?>
</div>
<?php }; if (get_sub_field ('filed1'));{ ?>
<div class = "class1">
<? php the_sub_field ('filed1'); ?>
</div>
<?php }; ?>

Kirby CMS/php: Checking the file type in order to apply varying markup?

Working with the Kirby CMS, I'm trying to pull all the files of a page and apply different markup to images and videos. In Kirby, there is the $file->type() command, which I think I would have to use in an if-statement in order to distuniguish the files, but my current code is not working. What I tried is this:
<?php
$page = page('PageTitle');
$page_files = $page->files();
?>
<div class="slider-container" id="slider#">
<div class="slider">
<?php foreach($page_files->sortBy('sort', 'asc') as $page_file): ?>
<?php if ($page_file->type() == 'image') { ?>
<div style="background: url('<?= $page_file->url() ?>'); background-size: cover; height: 100vh;"></div>
<?php endif; ?>
<?php endforeach ?>
</div>
</div>
What am I doing wrong?
The answer to my question is a rather obvious one, I made a simple syntactic mistake by using a { instead of : in the first line of the if-statement. This would be the proper, working version of the code, distinguishing between images and videos:
<?php if($file->type() == 'image'): ?>
<!-- markup for image -->
<?php endif ?>
<?php if($file->type() == 'video'): ?>
<!-- markup for video -->
<?php endif ?>

Include php files inside tab

I have a php file tab.php which is creating tabs.The code of tab.php is:
<ul id="tabs">
<?php
$tab=' ';
if($tab=='') $tab='setup';
//$tab=$_REQUEST['tab'];
if($tab=='setup'){ ?>
<li><b><span>Setup</span></b></li>
<?php
}else{ ?>
<li><span>Setup</span></li>
<?php } ?>
<?php if($tab=='options'){ ?>
<li><b><span>Options</span></b></li>
<?php }else{ ?>
<li><span>Options</span></li>
<?php } ?>
<?php if($tab=='questions'){ ?>
<li><b><span>Questions</span></b></li>
<?php }else{ ?>
<li><span>Questions</span></li>
<?php } ?>
<?php if($tab=='flow'){ ?>
<li><b><span>Flow</span></b></li>
<?php }else{ ?>
<li><span>Flow</span></li>
<?php } ?>
</ul>
<div style="clear:both; background-color:#edcb27; height:0px; overflow:hidden;"></div>
<div style="border:solid 3px #edcb27; background-color:#edcb27; padding:10px; font-family:Verdana, Geneva, sans-serif; font-size:11px;">
<label>Edit Mode</label>
<label>dfhfghj</label>
I have four php files namely setup.php,options.php,question.php and test.php.What I want is when I click on setup tab setup.php should open.When I click on option.php then my option.php should open and so on.Initially setup.php should be visible.So where should I include my all four php files so that particular php file should be open when clicking on tab?
If your page will be refresh each time when you press a tab you can use a switch statement and get tab value from query-string:
$tab = $_GET["tab"];
switch ($tab) {
case "setup":
require "setup.php";
break;
default:
break;
}
to load a YOUR_FILENAME.php.
Other (good) solution is use a asynchronous request with jQuery or other JavaScript libraries.
Cheers
If you are putting all your tab pages in the same folder as this code, this should do the trick
<ul id="tabs">
<?php
$tab='';
if(!isset($_GET['tab'])) $tab='setup';
else $tab = $_GET['tab'];
//$tab=$_REQUEST['tab'];
if($tab=='setup'){ ?>
<li><b><span>Setup</span></b></li>
<?php
}else{ ?>
<li><span>Setup</span></li>
<?php } ?>
<?php if($tab=='options'){ ?>
<li><b><span>Options</span></b></li>
<?php }else{ ?>
<li><span>Options</span></li>
<?php } ?>
<?php if($tab=='questions'){ ?>
<li><b><span>Questions</span></b></li>
<?php }else{ ?>
<li><span>Questions</span></li>
<?php } ?>
<?php if($tab=='flow'){ ?>
<li><b><span>Flow</span></b></li>
<?php }else{ ?>
<li><span>Flow</span></li>
<?php } ?>
</ul>
<div style="clear:both; background-color:#edcb27; height:0px; overflow:hidden;"></div>
<div style="border:solid 3px #edcb27; background-color:#edcb27; padding:10px; font-family:Verdana, Geneva, sans-serif; font-size:11px;">
<label>Edit Mode</label>
<label>dfhfghj</label>
<!-- assuming you are putting the content of the page here -->
require($tab.'.php');
I'd just do it with if(isset($_GET['setup'])) { display setup code } seems the simple solution to me.

Multiple Toggles Almost like Tabs JavaScript/ CSS

I want to create tabs that function like toggles, but instead only one toggle can be active at one time. The content of the tab also needs to be above the the tabs themselves. The problem is I am using a loop to generate the content as well as the tabs themselves.
I've got a nice javascript code right here that works perfectly fine. I understand this perfectly as well. The only problem is that it obviously doesn't disable other toggles when another one is clicked. Also having one "tab" / "toggle" always active. Code that could probably check the div id with a prefix of "post" and make all div id's with "post" to display:none besides the one that was clicked on. That would be perfect if that could be possible. Another way I could think of this is putting all the generated content into a container, and it simply disables all id's in the container besides the one that was clicked.
If this code can be modified to achieve that, it would be great. This is some very simple code that I understand very clearly. All I need is that it behaves more like tabs where only one can be active at once.
<script type="text/javascript">
function toggleMeMirror(a){
var e=document.getElementById(a);
if(!e) return true;
if(e.style.display=="none"){
e.style.display="inline"
} else {
e.style.display="none"
}
return true;
}
</script>
HTML / PHP
Loop 1 - The Content
<?php while ($queryepisodemirrors->have_posts()) : $queryepisodemirrors->the_post(); ?>
<?php if(get_post_meta(get_the_ID(), 'parentIDmirror', true) == $postIDCheck) { ?>
<div id="post-<?php the_ID(); ?>" style="display:none;">
<center><?php the_title(); ?><br /><br />
<?php echo get_post_meta(get_the_ID(), 'mirror_embed_code', true); ?>
<?php wprp(true);?>
</center>
</div>
<?php } ?>
<?php endwhile; ?>
Loop 2 - The actual toggles / tabs
<?php while ($queryepisodemirrors->have_posts()) : $queryepisodemirrors->the_post(); ?>
<?php if(get_post_meta(get_the_ID(), 'parentIDmirror', true) == $postIDCheck) { ?>
<div style="float: left; padding: 4px;">
<center>
<div class="post-<?php the_ID(); ?>" onclick="return toggleMeMirror('post-<?php the_ID(); ?>')" >
<div style="overflow: hidden; width: 150px; height: 100px;">
<div style="background: rgb(0, 0, 0) transparent; /* fallback color */ background: rgba(0, 0, 0, 0.8); color: white; padding: 2px;">
<center>
<?php echo get_post_meta(get_the_ID(), 'video_provider', true);
echo ' Mirror';?>
</center>
</div>
<img src="<?php echo $thumbnail_src; ?>" width="150px"/>
</div>
</div>
</center>
</div>
<?php } ?>
<?php endwhile; ?>
This is also tagged jquery so I'll just recommend that you include the jquery library and include:
$('.someclass').hide();
as the first line in the toggleMeMirror function.
Then, make sure that each of your looped content divs exist in the class "someclass".
like:
foreach($this as $that) {
print "<div class='someclass'>$that</div>";
}
then
function toggleMeMirror(a){
// hide all
$('.someclass').hide();
// show one
var e=document.getElementById(a);
if(!e) return true;
if(e.style.display=="none"){
e.style.display="inline"
} else {
e.style.display="none"
}
return true;
}
You can try something like this DEMO
HTML Code
<div id="one"><img src='http://img.widgetbox.com/thumbs/302/8fb0669c-72ee-454d-a08f-9700b8a5270a.png?4' height='50px' widht='50px' ></div><br>
<div id="two"><img src='http://ww2.valdosta.edu/~mecarter/Spongebob%20Reading.png' height='50px' widht='50px' ></div><br>
<div id="three"><img src='http://www.cliffdweller.com/blogPhotos/wrappingpaperbase/Spongebob%20Waving.png' height='50px' widht='50px' ></div><br><br>
<div id="thumb"><img src='http://img.widgetbox.com/thumbs/302/8fb0669c-72ee-454d-a08f-9700b8a5270a.png?4' height='200px' widht='200px' ></div>
jQuery
$("#one").click(function() {
$("#thumb").html("<img src='http://img.widgetbox.com/thumbs/302/8fb0669c-72ee-454d-a08f-9700b8a5270a.png?4' height='200px' widht='200px' >");
});
$("#two").click(function() {
$("#thumb").html("<img src='http://ww2.valdosta.edu/~mecarter/Spongebob%20Reading.png' height='200px' widht='200px' >");
});
$("#three").click(function() {
$("#thumb").html("<img src='http://www.cliffdweller.com/blogPhotos/wrappingpaperbase/Spongebob%20Waving.png' height='200px' widht='200px' >");
});

Categories