hallo,
deze is de code infunction.php :



add_action('init', 'my_register_styles');

function my_register_styles() {
    wp_register_style( 'auto-garage-style', get_template_directory_uri() . '/style.css' );    
    wp_register_style( 'auto-garage-contact-form', get_template_directory_uri() . '/contact-form.css' );

}
add_action( 'wp_enqueue_scripts', 'my_enqueue_styles' );

function my_enqueue_styles() {
    if ( is_front_page() ) {
        wp_enqueue_style( 'auto-garage-style' );
    } elseif ( is_page_template( 'contact.php' ) ) {        
        wp_enqueue_style( 'auto-garage-contact-form' );
    } else {
        wp_enqueue_style( 'auto-garage-style' );
    }
}




deze is de code in contact.php pagina :


<?php
 /* Template Name: Contact */ 
 
 ?>
<!DOCTYPE HTML>  
<html>

<style>
.error {color: #FF0000;}
</style>

	 
<div class="container">
<form id="contact" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<h3>Quick Contact</h3>
<h4>Contact us today, and get reply with in 24 hours!</h4>
<fieldset>
      <input placeholder="Your name" type="text" tabindex="1" required="" autofocus=""></fieldset>
<fieldset>
      <input placeholder="Your Email Address" type="email" tabindex="2" required=""></fieldset>
<fieldset>
      <input placeholder="Your Phone Number" type="tel" tabindex="3" required=""></fieldset>
<fieldset>
      <input placeholder="Your Web Site starts with http://" type="url" tabindex="4" required=""></fieldset>
<fieldset>
      <textarea placeholder="Type your Message Here...." tabindex="5" required=""></textarea></fieldset>
<fieldset>
      <button name="submit" type="submit" id="contact-submit" data-submit="...Sending">Submit</button></fieldset>
</form></div>
</html>


de probleem is:
de contact.php pagina erkend niet de contact-form.css bestand.
ik heb paar keer voor zekerheid de cache van mij computer schoon gemaakt . maar het probleem blijft.
ik heb geprobeerd om link te maken van contact-form-css maar de probleem is hetzelfde.
dank u wel
En staat die wel in de HTML-broncode van de browser zelf?
dank u wel ,
wat wilt u zeggen precies.
waar kan het fout zijn
Dat die CSS-sheet misschien niet in je HTML staat.
dank u wel ,
ik heb wel custom css (contact-form-css) net als u ziet boven in function.php.
css code is :


/*------contact-form
 */

* {
	margin:0;
	padding:0;
	box-sizing:border-box;
	-webkit-box-sizing:border-box;
	-moz-box-sizing:border-box;
	-webkit-font-smoothing:antialiased;
	-moz-font-smoothing:antialiased;
	-o-font-smoothing:antialiased;
	font-smoothing:antialiased;
	text-rendering:optimizeLegibility;
}

.container {
	max-width:400px;
	width:100%;
	margin:0 auto;
	position:relative;
}

#contact input[type="text"], #contact input[type="email"], #contact input[type="tel"], #contact input[type="url"], #contact textarea, #contact button[type="submit"] { font:400 12px/16px "Open Sans", Helvetica, Arial, sans-serif; }

#contact {
	background:#F9F9F9;
	padding:25px;
	margin:50px 0;
}

#contact h3 {
	color: #F96;
	display: block;
	font-size: 30px;
	font-weight: 400;
}

#contact h4 {
	margin:5px 0 15px;
	display:block;
	font-size:13px;
}

fieldset {
	border: medium none !important;
	margin: 0 0 10px;
	min-width: 100%;
	padding: 0;
	width: 100%;
}

#contact input[type="text"], #contact input[type="email"], #contact input[type="tel"], #contact input[type="url"], #contact textarea {
	width:100%;
	border:1px solid #CCC;
	background:#FFF;
	margin:0 0 5px;
	padding:10px;
}

#contact input[type="text"]:hover, #contact input[type="email"]:hover, #contact input[type="tel"]:hover, #contact input[type="url"]:hover, #contact textarea:hover {
	-webkit-transition:border-color 0.3s ease-in-out;
	-moz-transition:border-color 0.3s ease-in-out;
	transition:border-color 0.3s ease-in-out;
	border:1px solid #AAA;
}

#contact textarea {
	height:100px;
	max-width:100%;
  resize:none;
}

#contact button[type="submit"] {
	cursor:pointer;
	width:100%;
	border:none;
	background:#0CF;
	color:#FFF;
	margin:0 0 5px;
	padding:10px;
	font-size:15px;
}

#contact button[type="submit"]:hover {
	background:#09C;
	-webkit-transition:background 0.3s ease-in-out;
	-moz-transition:background 0.3s ease-in-out;
	transition:background-color 0.3s ease-in-out;
}

#contact button[type="submit"]:active { box-shadow:inset 0 1px 3px rgba(0, 0, 0, 0.5); }

#contact input:focus, #contact textarea:focus {
	outline:0;
	border:1px solid #999;
}
::-webkit-input-placeholder {
 color:#888;
}
:-moz-placeholder {
 color:#888;
}
::-moz-placeholder {
 color:#888;
}
:-ms-input-placeholder {
 color:#888;
}


[size=xsmall]Toevoeging op 02/07/2022 22:26:08:[/size]

deze css en html code ziet in codepen

[size=xsmall]Toevoeging op 02/07/2022 22:46:41:[/size]

en het werkt ik heb het bestudeerd en getest.
Het is dus opgelost?
Wat Ariën bedoelt is:

Open de pagina in je browser.

Klik met de rechtermuisknop en selecteer 'view source', 'view source code', 'bekijk broncode' of iets wat daarop lijkt. Als het goed is krijg je nu de code van de pagina te zien. Kijk nu of daar jouw css-bestand tussen staat.
dank u wel ,
ik heb eindelijk gevonden het probleem.
om custom pagina te maken in wordpress u moet deze lijnen toevoegen in custom-page.php

<?php
 /* Template Name: Contact */ 
  
get_header();
the_content();
?>
<?php
get_footer();



dan ik heb het html code in de pagina sectie van wordpress in contact pagina toegevoegd nadat ik heb onder template aan de rechte kant(widget) de optie custom-page.php gekozen welke is in mij geval contact.php .
het werkt prima.
plus ik heb deze 2 lijnen voor 2 css files in function.php toegevoegd .

wp_enqueue_style( 'auto-garage-style', get_stylesheet_uri(), array(), _S_VERSION );

wp_enqueue_style( 'auto-garage-contact-form-style', get_template_directory_uri() . '/contact-form.css' ); 



u kun zien op url :https://webdesignleren.com/contact/

maar er blijft een vraag voor mij voor deze code in function.php


add_action('init', 'my_register_styles');

function my_register_styles() {
    wp_register_style( 'auto-garage-style', get_template_directory_uri() . '/style.css' );    
    wp_register_style( 'auto-garage-contact-form', get_template_directory_uri() . '/contact-form.css' );

}
add_action( 'wp_enqueue_scripts', 'my_enqueue_styles' );

function my_enqueue_styles() {
    if ( is_front_page() ) {
        wp_enqueue_style( 'auto-garage-style' );
    } elseif ( is_page_template( 'contact.php' ) ) {        
        wp_enqueue_style( 'auto-garage-contact-form' );
    } else {
        wp_enqueue_style( 'auto-garage-style' );
    }
}




deze code boven is bedoeld custom css voor custom.php pagina maar het werkt niet ik heb in google voor oplossing gezocht voor deze code zonder resultaat ook in wordpress codec ik kunde niet een antwoord vinden.
ik heb 2 css files
1-style.css
2-contact-form.css
en ik heb deze 2 in condition geplaatst boven.
ik wil graag weten wat het fout kan zijn boven in function.php.
dank u wel
Fix je code blok even.
ten eerste ik heb beantwoordt de oplossing van het probleem na 2 dagen zoeken.
2- ik wil weten wat het fout kan zijn in de code dat ik heb gebruikt om contact-form.css richten naar contact.php pagina.
de code is:

add_action('init', 'my_register_styles');

function my_register_styles() {
    wp_register_style( 'auto-garage-style', get_template_directory_uri() . '/style.css' );    
    wp_register_style( 'auto-garage-contact-form', get_template_directory_uri() . '/contact-form.css' );

}
add_action( 'wp_enqueue_scripts', 'my_enqueue_styles' );

function my_enqueue_styles() {
    if ( is_front_page() ) {
        wp_enqueue_style( 'auto-garage-style' );
    } elseif ( is_page_template( 'contact.php' ) ) {        
        wp_enqueue_style( 'auto-garage-contact-form' );
    } else {
        wp_enqueue_style( 'auto-garage-style' );
    }
}



het kan ook als iemand weet vergelijkbaar code om custom.css binden voor custom.page.php .
dank u wel
- Ariën - op 03/07/2022 19:48:20

Fix je code blok even.


Graag even aanpassen in je bericht van 19:36:07. Zet even netjes <?php en ?> om je PHP-code.

Reageren