Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

lidiamansur on "Woocommerce - acrescentar botão 'Adicionar e finalizar'"

$
0
0

Pessoal, utilizei o Woocommerce para a criação de uma loja virtual de orçamentos (não há preços nos produtos). Alterei o botão 'Comprar' para 'Adicionar ao orçamento'. Este envia os produtos para o carrinho e posteriormente direciona o cliente para o formulário de orçamento.

Preciso acrescentar um outro botão 'Adicionar e finalizar', de modo que o cliente seja direcionado já para o formulário de orçamento, sem passar pelo carrinho.

Alguém poderia me orientar neste caso?


mrylande on "Image Header not Responsive"

$
0
0

Hello!

I am using a modified version of the Snaps theme, and I am having troubles getting my header image to display correctly on mobile devices.

On desktops and laptops and full-sized resolution monitors, the image displays great. (it's 1200 x 500)

http://mikerylander.com

But when I try to tweak the header.php file or the style.css file to have it resize for mobile devices, I am running into troubles.

As of now, I have it set so the image will change width size to the window size, but I end up with really ugly bars on the top and the bottom of the header image. I know I need to change my #masthead height, I just can't figure out where and how to do it.

I have tried many different css hacks, and I have found this issue expressed explicitly for the Snaps theme - https://wordpress.org/support/topic/not-responsive-header?replies=4 - but I am a lot a loss for fixes and ideas.

Can anyone please assist? I am familiar with the @media command, just don't know where to use it here.

Thank you!!!

schnellc on "Calendly and iframes"

eSas on "Get Custom Widget Contet"

$
0
0

Hello guys!

I'm currently trying to figure out a way to grab and edit all of the content for running widgets on a website, I was only able to do this with wp text widget, but my main question is how do I do it for custom widgets?

For widget_text content I was using code below, but as I said earlier this only changes content for text widget:

add_action( 'plugins_loaded', 'change_widget' );
function change_widget(){
	//add_filter( 'dynamic_sidebar_params', 'jmk_widget' );
	add_filter( 'widget_text', 'jmk_widget', 99 );
}

The commented line gets all of the widgets and few parameters, but I didn't quite figured out If I can change it's output with this.

Thank you for any help in advance!

dawgawel on "wp.media.query multiple types"

$
0
0

Is it possible (and how) to create js media collection using multiple (but not all) media types, for example 'image' and 'video'?

For example:

if ( ! this.get('library') ) {
    this.set( 'library', wp.media.query( { type: 'image|video' } ) );
}

lacorietowers on "Plug in to password protect pages"

$
0
0

hopefully someone here can help me. I am looking for another way to password protect pages other than using the built in wordpress option. when i use that option i get this error message "/wp-login.php?action=postpass" and I've tried everything to fix it , with no avail. So it there another plug in that does the same thing the wordpress password protected page option does??

bigmikey00 on "Help with custom Plugin Shortcodes"

$
0
0

So i am trying to program my own plugin. I have alot of the plugin setup and working on the admin side. I am now programming the shortcode so i can display a Table from sql data onto a WP Page. [test] is my short code
i have it calling the function right and the table is displayed. The problem i am having is if i refresh the page, the table stays the same even if i update the table through phpmyadmin. The table data is clearly different. In the admin side i have the same table which updates correctly. The problem is the front end shortcode version is not updating.

Any ideas how i can fix this?

function form_creation(){
global $wpdb;
$Ocount = $wpdb->get_var( "SELECT COUNT(*) FROM mytbl WHERE status='Open'" );
			echo "<h2>{$Ocount} Open Slots Avaiable\n</h2>";
			echo "";
			echo "<table class='tg' id='tableID'>";
			echo     "<tr>";
			echo     " <th class='tg-dfh4'>Slot Numbers</th>";
			echo     "<th class='tg-iulr'>Purchased By</th>";
			echo     "<th class='tg-c7d0'>Payment Status</th>";
			echo     "</tr>";
$result = $wpdb->get_results('SELECT Slot_Num, Purchased_By, Payment_Status FROM mytbl');
			foreach ( $result as $row )
			{
					  echo "<tr>";
					  echo  "<td class='tg-dfh4'>$row->Slot_Num</th>";
					  echo  "<td class='tg-iulr'>$row->Purchased_By</th>";
					  echo "<td class='tg-c7d0'>$row->Payment_Status";
							if($row->Payment_Status == "Open"){
							$price = $row->Price;
							$slot = $row->Slot_Num;
							echo "<form action='purchase.php' method='POST' >";
							echo "<input type='hidden' name='price' value='$price'/>";
							echo "<input type='hidden' name='slot' value='$slot'/>";
							echo "<input type='submit' name='Payme' id='Payme' class='button button-primary' value='Purchase'  />";
							echo "</form>";
							}
					  echo "</th>";
					  echo "</tr>";
			}

absolutelydelicious on "Child Custom Post Type with Archive"

$
0
0

I know how to make a custom post type and make them hierarchical but I am struggling to make a level deeper. I have considered using tags.

This is my scenario:

books (archive index of books) > adventure (archive index of adventure books)
movies (archive index of movies) > comedy (archive index of comedy movies)

How would you advise approaching this?

Thanks a lot,

AD


Andre on "Add shortcode Columns in a div wrapper"

$
0
0

I've been trying to find a solid working solution online on how I can return shortcode columns in an outer wrapper container such as a div. Does anyone have a method that works?

My test code for returning the column, in this case, a one_third column:

if ( !function_exists('my_column') ) {
	function my_column( $atts, $content = null ) {
		extract(shortcode_atts(array(
			'column' => 'one-third',
			'last' => false,
		), $atts));

		$last_class = '';
		$last_div = '';
		if( $last ) {
			$last_class = 'myclass-column-last';
			$last_div = '<div class="clearfix separator"></div>';
		}

		return '<div class="myclass-' . $column . $last_class . '">' . do_shortcode($content) . '</div>' . $last_div;
	}
	add_shortcode('my_column', 'my_column');
}

The shortcode columns is generated from the editor and you would click the Add Column button to get your columns created before you click Insert (into your page). The problem is, I need my multiple columns to be wrapped in a <div> but do not know how this is done. I've looked online but the closest tutorial I came across was from 4 years ago and didn't work. Currently at the moment, I created a "column wrapper" shortcode which you would then add the columns into that via the shortcode generator, but to me that doesn't sound efficient.

Thanks in advance :)

sonicnick on "Custom XML Import Default Values, Required Fields"

$
0
0

Hi There, I'm trying to migrate custom CMS content with user comments into WP.
I have seen the XML format file example here:

http://google-blog-converters-appengine.googlecode.com/svn/trunk/samples/wordpress-sample.wxr

But don't fully understand how all of the values work. `
Is there a specification somewhere that explains what values are required, what can be left out etc to still be able to import content?
Specifically these meta values

<wp:postmeta>
<wp:meta_key>_edit_lock</wp:meta_key>
<wp:meta_value>1210966825</wp:meta_value>
</wp:postmeta>
<wp:postmeta>
<wp:meta_key>_edit_last</wp:meta_key>
<wp:meta_value>2575641</wp:meta_value>
</wp:postmeta>

And
<wp:comment_id>8</wp:comment_id> - Iif I leave blank will this be auto generated on insert?

skalibran on "Get permalink of the current slider post"

$
0
0

Hey there,

I'm using the twentyfourteen theme (modded by me). Now I want to display the link on the slider. With 'the link' I mean the link where the slider navigates you when you click on it. If I just call the permalink it gives me the link of the latest post. Thats fine if the slider displays the latest post, but if the user clicks on another slider image the get_permalink(); is not up to date anymore.

Any ideas on how I can get the permalink that is displayed by the slider?

Thanks in advance!

bayauk on "Media editor backbone js: Get the current action"

$
0
0

Hello!

I'm creating a plugin that adds an option to the native WP gallery.

When a new gallery is created (clicking the "Create Gallery" button in the media popup), a <select> is added, and I have a backbone event listening for the 'change' event of this <select>.

However, I only want to listen for the change event when the gallery is being newly created, rather than when editing an existing gallery.

My code so far is:

wp.media.view.Settings.Gallery = wp.media.view.Settings.Gallery.extend({
						events: function() {

							var the_events = {};

							//NEED TO GET STATE (ie, 'creating gallery for first time' rather than 'edit gallery'....
							var is_create_gallery = true;

							//IF WE'RE EDITING, SET IT TO FALSE
							//--here--

							if (is_create_gallery) {
								_.extend( the_events, { 'change select[data-setting="gallerytype"]' : 'gallerytypechanged' } );
							}

							return the_events;
						},
						gallerytypechanged: function( e ){
							e.preventDefault();

							var self = this;

							var gallery_type = jQuery( e.currentTarget ).val();

							if( gallery_type != 'native' ){
								self.update.apply( self, ['gallerytype'] );
							}

							return self;
						},
						template: function(view) {
							return wp.media.template('gallery-settings')(view) + wp.media.template('delight-gallery-type')(view);
						},
					});

Basically the --here-- code should be a check to determine whether we're editing an existing gallery, or creating a new one.

Does anybody know where to check which state we're in?

Thanks!

sabgraphicsuk on "woocommerce custom tab"

$
0
0

Hello

I'm scratching my head on woocommerce

On a product page, does anyone know how to move "product options/variations/quantity/add to cart block" etc, to inside a tab, such as 'description' tab?

Sounds simple - but It's completely puzzling me!

Many thanks

Stickhead on "asign custom feed theme to custom post type"

$
0
0

Hey everyone,

I am facing the following issue: I want to create a customized RSS feed for each of the custom post types that I use in my theme. I managed to register the new feed template and the callback function, to create the template file and to modify the template file as I wish (essentially I did as described here: http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-rss-feeds-in-wordpress/ ).

Now here is my question: How can I assign a particular post type to this template? In other words, I want Custom post type A to be displayed using feed template A, and Custom post type B to be displayed using feed template B. If I use my newly created template, it only displays entries with the post type "post".

If any additional infos are required, please let me know, Thanks already in advance!

jlivings on "Do I need to use esc_html with get_bloginfo?"

$
0
0

Should I be using esc_html with get_bloginfo? For example if I'm filtering wp_title in my functions.php akin to something like this:

# CUSTOM PAGE TITLE

add_filter('wp_title', 'my_home_title');
function my_home_title($title) {
if (is_front_page()) {
return esc_html((get_bloginfo( 'description' ) . ' | ' . get_bloginfo( 'name' )));
}
else {
return esc_html((get_the_title() . ' | ' . get_bloginfo( 'name' )));
}
return $title;
}

# END CUSTOM PAGE TITLE

Similarly would I need to use esc_url for urls that are entirely comprised of wordpress functions? Such as when using the permalink like:

<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

agenciaklox on "Loop with wpdb class"

$
0
0

Hi,

I need a little help, i'm developing my first plugin, and i need to push some data from database using wpdb class and populate a select with this data.

So i start to push it, but i don't know how to do the loop with the data.

<select name='wcwp_settings[wcwp_select_state]' id="cod_estados">
		<option value='0'>Selecione uma Opção</option>
		<?php
			global $wpdb;
			$states = $wpdb->get_col("SELECT nome FROM estados");
			$i = 0;
			while($i <= '27'){
		?>
		<option value='0'><?php echo $states[$i]; ?></option>
		<?php
				$i++;
			}
		?>
	</select>

Do you know how to do it?

Thanks :D

dtralex on "Showing Related Posts at Two Places"

$
0
0

Hello, I am using this code

<?php $orig_post = $post;
global $post;
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'posts_per_page'=> 5, // Number of related posts that will be shown.
'caller_get_posts'=>1
);
$my_query = new wp_query( $args );
if( $my_query->have_posts() ) {
echo '<div id="related_posts"><h3>Related Posts</h3>

    ';
    while( $my_query->have_posts() ) {
    $my_query->the_post();?>

    <div class="relatedthumb">
    <ul style="list-style-type:disc">

  • "><?php the_title(); ?>

</div>

<?
}
echo '</div>';
}
}
$post = $orig_post;
wp_reset_query(); ?>

to show related posts in single.php

this way I am able to show the related posts below the post.

I want to show the second related post in sidebar.

I am able to show the related post in sidebar but it is showing the same related posts as it was shown below the post.

Can it be possible to show different related post? Like 1-5 related posts below the posts and 6-10 related posts in the sidebar...

bhlarsen on "Right way to add "SSO redirect""

$
0
0

(First post to the WordPress forums, please be gentle.)

I am moving functionallity from our legacy CMS to WordPress and have one case where I am uncertain whether I am doing things in the best way possible.

Here is the scenario: I need to implement an URL that we can link to. When a logged in user accesses this URL information from the user session is used to compute another URL at another site which the user is redirected to. The computed URL contains a token that automatically logs the user in at the other site.

So the process is something like

  1. user accesses mysite.org/redirectme
  2. code at /redirectme fetches the user object and meta data and computes token X, possibly using backend web service calls
  3. user is redirected to othersite.org?token=X
  4. user is logged in at othersite.org

Note that I cannot do much about improving this workflow - as I said I am reimplementing the mysite.org side of an already existing setup.

The code for doing this is fairly straightforward, my main concern is how to package it in a sensible manner.

My current (working) setup is something like this:

  • I have implemented a plugin MySSO that contains a class with all the necessary code for computing the token.
  • The plugin also contains a sso.php which requires wp-blog-header.php, calls a static method in my class for computing the token and redirects the user
  • To prevent having to link into ".../wp-content/plugins/MySSO/sso.php" I have created a symlink from /sso.php to the file

My main concerns are:

  1. Is an external PHP file the right way to go for acheiving this? Are there other good options?
  2. Can the plugin itself create the symlink mentioned in the last step above? Or possibly copy or write the file? Or do I have to do this manually after installing the plugin?

Any other comments on my approach are welcome.

RussellSocial on "Deleting or Disable a script from a theme."

$
0
0

http://themes.themegoods2.com/grandrestaurant/
I am using the above theme. On the main menu there is a RESERVATIONS button (with a border around it). I cannot use that form because we have 2 restaurants with 2 different email addresses for reservations/bookings and I would like there to be a extra field where the user can choose which restaurant and the theme does not allow for multiple email addresses.
1st prize would be for the user to be able to choose(on the form) which restaurant he/she would like to book and the form sends an email to the relevant email address.
If I have to use a contact form plugin. I need to hide the border button from the main menu or delete it and/or disable it.
Can anyone help? Thanks

jimbolaya on "Howto NOT add link for images in Wordpress App (iOS)?"

$
0
0

Hi everybody,

I use the Wordpress App on iOS very often. Unfortunately when uploading an image (from my iPhone media library) in a blog post, the app always adds "an " to link the image to itself.

This is very disturbing because I always have to go into the HTML code (in the editor of the app) to delete this a href code manually.

Is there any way that the app doesnt link images?

I tried the wordpress plugin "No Image Link" but obviously this only works when I insert new posts using the webbrowser - not when I use the iOS App.

Where does the app get the HTML code for the image insert get from? Is this somehow attached to side templates? Any ideas?

Any hints are highly appreciated!

Rgds, Jan

Viewing all 8245 articles
Browse latest View live




Latest Images