I have 3 buttons in my indexSuccess in the backend of my project. The show and edit buttons work fine but the delete goes to show.
I think the code is right, here it is:
<div class="cont2">
<a href="<?php echo url_for('marcacao/delete?id='.$feasy_marcacao->getId()); ?>">
<div class="btapagar"/>
<p class="btapagartxt">
Apagar
</p>
</div>
</a>
I found the problem. This <a href="<?php echo url_for('marcacao/delete?id='.$feasy_marcacao->getId()); ?>"> is wrong. It should be: <a href="<?php echo 'marcacao/'.$feasy_marcacao->getId().'/delete' ?>" >
Thank you anyway
Check your log for the app you are running - you can see what happens which this link is clicked - you need to check the correct route is being followed - then check the controller to see what you are doing for that routes action.
I don't think re-creating the URLs by hand is the best practice, you should be using url_for() or link_to().
I had the same problem with a project on symfony 1.2 (Propel) using the admin generator : all the links worked fine except for delete, so I added a route in routing.yml like that :
marcacao_delete:
url: /marcacao/:id/delete
param: { module: marcacao, action: delete }
and that solved the problem
Related
I'm using the template "Twentyseventeen" and created a child theme of it.
Now I added the_custom_logo(); to header.php and the custom-logo link is rendered,
but without the img src. So I have a blank space. I searched now for hours and can't find the reason. Even if I switch back to orignal Twentyseventeen theme the img src was missing. Well I'm not very famiiar to wordpress and if anybody could help me to fix this? Thank you
Hi :) try to add <img> like this
<img src="<?php the_custom_logo();?>"/>
In my theme I use This:
<div class="logo">
<a href="<?php echo get_home_url(); ?>">
<?php $logo_id = get_theme_mod( 'custom_logo' );?>
<?php echo wp_get_attachment_image( $logo_id , 'full' ); ?>
</a>
</div>
I hope that it help you :)
Possibly you don't have custom logo set in the backend or it needs a reset.
Go to the Admin Dashboard > Appearance > Customizer > Site Identity
Check if you've set the custom logo there. If it is set, remove it
and reset it.
If you don't see any option to set custom logo there, your theme doesn't support custom logo option. In this case the_custom_logo() or related functions will not work. Read this guide to add support for custom logo and then using the URL or printing the logo with markup.
I have run into a very interesting problem. I am working on a site for a client of mine and have run into this issue using Advanced Custom Fields no wordpress. I have added a new custom field to the site for their rewards program spot, and I am having trouble getting the url field to work corretly. I have the code added to the template php file that it needs to be in and it looks like this at the moment.
<div class="row">
<?php $ficvalue = get_field('free-icecream-url');
if ($ficvalue) {
$ficurl = esc_url($ficvalue);
}?>
<h3 class="heading" style="text-align: center;"><?php the_field('free-icecream-header'); ?></h3>
<a href"<?php echo $ficurl; ?>" class="btn btn-primary" style="max-width: 15em;"><?php the_field('free-icecream-btn'); ?></a>
</div>
When I put the url into the custom url field on the backend in the page editor, it doesn't appear in the anchor correctly. if I add this line to the page, it shows the url correctly on the page itself:
<?php echo get_field('free-icecream-url'); ?>
This will show the url as it is inserted into the custom field, however adding it into the anchor's href like this provides a different result.
<?php the_field('free-icecream-btn'); ?>
<!-- results as the following in chromes inspect -->
<!-- https: www.rococoicecream.com rococo-rewards
Instead of https://www.rococoicecream.com/rococorewards -->
I have tried to use esc_url() and esc_html() to no avail. and when using the_field() it yields the same results. What am I doing wrong?
The answer to my question here was answered shortly after posting it. I updated the original question but I will also place it here. I found the problem I was having was that I missed a = after the href in the anchor for my button. After finding that out, it works like a charm.
I have been attempting to create a modal contact form using the two plugins: Contact Form 7 and Easy Fancy Box.
I am also using visual composer in order to build my site..
I have therefore created a 'Raw Html' element, and in the element I have the following code:
Contact Us
<div style="display:none" class="fancybox-hidden">
<div id="contact_form_pop">
<?php echo do_shortcode('[contact-form-7 id="4" title="Contact form 1"]'); ?>
</div>
</div>
This does not work and the browser seems to comment out the php code, I know that php is a server side language but I was simply following a tutorial I found. The result is this when the button is clicked:
I then tried the code without the php and wordpress' 'do_shortcode', as another tutorial instructed:
Contact Us
<div style="display:none" class="fancybox-hidden">
<div id="contact_form_pop">
[contact-form-7 id="4" title="Contact form 1"]
</div>
</div>
This also didn't work and resulted in:
If anyone could help me to circumnavigate these issues and create a modal/pop-up contact form whilst using visual composer (I ahve built most of my site using it) I would be extremely greatful!
The code you pasted exactly works, the problem is that the shortcode is not picked up by wordpress. Make sure you paste the code in a text block, and the mode of the text block is 'Text' not 'Visual'.
Just tested and it works fine.
instead of only typing the shortcode use the correct function:
<?php echo do_shortcode('[contact-form-7 id="4" title="Contact form 1"]'); ?>
if you want to store the shortcode inside a php variable, you can use this:
$my_shortcode = '[contact-form-7 id="4" title="Contact form 1"]';
echo do_shortcode( $my_shortcode );
I am creating a theme on wordpress with Bootstrap CDN. I created a button as:
<div class="col-md-4"><a href="<?php echo get_permalink(); ?>"
class="btn btn-lg btn-block">Read Latest</a></div>
It displays link as button and when I click it, url bar displays the link that should be opened, but page doesn't open.
I know this is a very noob question but I'm stuck, any help is appreciated.
Thanks!
Update:
The Resulting html link to the php I used is: http://localhost/baatega/bad-day-eh/
First, I don't quite understand the issue - the link is not correct? or what? Could you paste here please print screen or reproduce the issue in jsFiddle? It's more or less question for the WordPress development forum here, however if it's the case of link:
Check if get_permalink(); is used within the Loop. (if not, you have to pass the ID as an argument to it)
try to echo the escaped url: esc_url( get_permalink() );
Have a look here: https://developer.wordpress.org/reference/functions/get_permalink/
In Wordpress, is there an official way to link from a single post view to that post type's index view? I'm working with custom post types. I've googled around for a wordpress function but there doesn't seem to be one for this and I'd like to avoid hardcoding a URL.
Thanks!
<a href="<?php bloginfo('url'); ?>" > Home </a>